@d2runewizard/d2s 2.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/lib/binary/bitreader.d.ts +22 -0
- package/lib/binary/bitreader.js +100 -0
- package/lib/binary/bitreader.js.map +1 -0
- package/lib/binary/bitwriter.d.ts +21 -0
- package/lib/binary/bitwriter.js +118 -0
- package/lib/binary/bitwriter.js.map +1 -0
- package/lib/binary/constants.d.ts +4 -0
- package/lib/binary/constants.js +9 -0
- package/lib/binary/constants.js.map +1 -0
- package/lib/d2/attribute_enhancer.d.ts +5 -0
- package/lib/d2/attribute_enhancer.js +593 -0
- package/lib/d2/attribute_enhancer.js.map +1 -0
- package/lib/d2/attributes.d.ts +4 -0
- package/lib/d2/attributes.js +99 -0
- package/lib/d2/attributes.js.map +1 -0
- package/lib/d2/constants.d.ts +4 -0
- package/lib/d2/constants.js +16 -0
- package/lib/d2/constants.js.map +1 -0
- package/lib/d2/d2s.d.ts +10 -0
- package/lib/d2/d2s.js +106 -0
- package/lib/d2/d2s.js.map +1 -0
- package/lib/d2/header.d.ts +8 -0
- package/lib/d2/header.js +95 -0
- package/lib/d2/header.js.map +1 -0
- package/lib/d2/items.d.ts +17 -0
- package/lib/d2/items.js +728 -0
- package/lib/d2/items.js.map +1 -0
- package/lib/d2/skills.d.ts +4 -0
- package/lib/d2/skills.js +45 -0
- package/lib/d2/skills.js.map +1 -0
- package/lib/d2/stash.d.ts +3 -0
- package/lib/d2/stash.js +196 -0
- package/lib/d2/stash.js.map +1 -0
- package/lib/d2/types.d.ts +402 -0
- package/lib/d2/types.js +15 -0
- package/lib/d2/types.js.map +1 -0
- package/lib/d2/versions/default_header.d.ts +5 -0
- package/lib/d2/versions/default_header.js +721 -0
- package/lib/d2/versions/default_header.js.map +1 -0
- package/lib/data/parser.d.ts +3 -0
- package/lib/data/parser.js +627 -0
- package/lib/data/parser.js.map +1 -0
- package/lib/data/versions/96_constant_data.d.ts +14427 -0
- package/lib/data/versions/96_constant_data.js +5 -0
- package/lib/data/versions/96_constant_data.js.map +1 -0
- package/lib/data/versions/99_constant_data.d.ts +15572 -0
- package/lib/data/versions/99_constant_data.js +5 -0
- package/lib/data/versions/99_constant_data.js.map +1 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +47 -0
- package/lib/index.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,721 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.writeHeader = exports.readHeader = void 0;
|
|
4
|
+
const bitreader_1 = require("../../binary/bitreader");
|
|
5
|
+
const bitwriter_1 = require("../../binary/bitwriter");
|
|
6
|
+
const difficulties = ["normal", "nm", "hell"];
|
|
7
|
+
function readHeader(char, reader, constants) {
|
|
8
|
+
var _a, _b, _c, _d;
|
|
9
|
+
char.header.filesize = reader.ReadUInt32(); //0x0008
|
|
10
|
+
char.header.checksum = reader.ReadUInt32().toString(16).padStart(8, "0"); //0x000c
|
|
11
|
+
reader.SkipBytes(4); //0x0010
|
|
12
|
+
if (char.header.version > 0x61) {
|
|
13
|
+
reader.SeekByte(267);
|
|
14
|
+
}
|
|
15
|
+
char.header.name = reader.ReadString(16).replace(/\0/g, ""); //0x0014
|
|
16
|
+
if (char.header.version > 0x61) {
|
|
17
|
+
reader.SeekByte(36);
|
|
18
|
+
}
|
|
19
|
+
char.header.status = _readStatus(reader.ReadUInt8()); //0x0024
|
|
20
|
+
char.header.progression = reader.ReadUInt8(); //0x0025
|
|
21
|
+
char.header.active_arms = reader.ReadUInt16(); //0x0026 [unk = 0x0, 0x0]
|
|
22
|
+
char.header.class = constants.classes[reader.ReadUInt8()].n; //0x0028
|
|
23
|
+
reader.SkipBytes(2); //0x0029 [unk = 0x10, 0x1E]
|
|
24
|
+
char.header.level = reader.ReadUInt8(); //0x002b
|
|
25
|
+
char.header.created = reader.ReadUInt32(); //0x002c
|
|
26
|
+
char.header.last_played = reader.ReadUInt32(); //0x0030
|
|
27
|
+
reader.SkipBytes(4); //0x0034 [unk = 0xff, 0xff, 0xff, 0xff]
|
|
28
|
+
char.header.assigned_skills = _readAssignedSkills(reader.ReadArray(64), constants); //0x0038
|
|
29
|
+
char.header.left_skill = (_a = constants.skills[reader.ReadUInt32()]) === null || _a === void 0 ? void 0 : _a.s; //0x0078
|
|
30
|
+
char.header.right_skill = (_b = constants.skills[reader.ReadUInt32()]) === null || _b === void 0 ? void 0 : _b.s; //0x007c
|
|
31
|
+
char.header.left_swap_skill = (_c = constants.skills[reader.ReadUInt32()]) === null || _c === void 0 ? void 0 : _c.s; //0x0080
|
|
32
|
+
char.header.right_swap_skill = (_d = constants.skills[reader.ReadUInt32()]) === null || _d === void 0 ? void 0 : _d.s; //0x0084
|
|
33
|
+
char.header.menu_appearance = _readCharMenuAppearance(reader.ReadArray(32), constants); //0x0088 [char menu appearance]
|
|
34
|
+
char.header.difficulty = _readDifficulty(reader.ReadArray(3)); //0x00a8
|
|
35
|
+
char.header.map_id = reader.ReadUInt32(); //0x00ab
|
|
36
|
+
reader.SkipBytes(2); //0x00af [unk = 0x0, 0x0]
|
|
37
|
+
char.header.dead_merc = reader.ReadUInt16(); //0x00b1
|
|
38
|
+
char.header.merc_id = reader.ReadUInt32().toString(16); //0x00b3
|
|
39
|
+
char.header.merc_name_id = reader.ReadUInt16(); //0x00b7
|
|
40
|
+
char.header.merc_type = reader.ReadUInt16(); //0x00b9
|
|
41
|
+
char.header.merc_experience = reader.ReadUInt32(); //0x00bb
|
|
42
|
+
reader.SkipBytes(144); //0x00bf [unk]
|
|
43
|
+
reader.SkipBytes(4); //0x014f [quests header identifier = 0x57, 0x6f, 0x6f, 0x21 "Woo!"]
|
|
44
|
+
reader.SkipBytes(4); //0x0153 [version = 0x6, 0x0, 0x0, 0x0]
|
|
45
|
+
reader.SkipBytes(2); //0x0153 [quests header length = 0x2a, 0x1]
|
|
46
|
+
char.header.quests_normal = _readQuests(reader.ReadArray(96)); //0x0159
|
|
47
|
+
char.header.quests_nm = _readQuests(reader.ReadArray(96)); //0x01b9
|
|
48
|
+
char.header.quests_hell = _readQuests(reader.ReadArray(96)); //0x0219
|
|
49
|
+
reader.SkipBytes(2); //0x0279 [waypoint header identifier = 0x57, 0x53 "WS"]
|
|
50
|
+
reader.SkipBytes(4); //0x027b [waypoint header version = 0x1, 0x0, 0x0, 0x0]
|
|
51
|
+
reader.SkipBytes(2); //0x027f [waypoint header length = 0x50, 0x0]
|
|
52
|
+
char.header.waypoints = _readWaypointData(reader.ReadArray(0x48)); //0x0281
|
|
53
|
+
reader.SkipBytes(2); //0x02c9 [npc header identifier = 0x01, 0x77 ".w"]
|
|
54
|
+
reader.SkipBytes(2); //0x02ca [npc header length = 0x34]
|
|
55
|
+
char.header.npcs = _readNPCData(reader.ReadArray(0x30)); //0x02cc
|
|
56
|
+
}
|
|
57
|
+
exports.readHeader = readHeader;
|
|
58
|
+
function writeHeader(char, writer, constants) {
|
|
59
|
+
writer
|
|
60
|
+
.WriteUInt32(0x0) //0x0008 (filesize. needs to be writen after all data)
|
|
61
|
+
.WriteUInt32(0x0); //0x000c (checksum. needs to be calculated after all data writer)
|
|
62
|
+
if (char.header.version > 0x61) {
|
|
63
|
+
writer.WriteArray(new Uint8Array(Array(20).fill(0))); // 0x0010
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
writer
|
|
67
|
+
.WriteArray(new Uint8Array([0x00, 0x00, 0x00, 0x00])) //0x0010
|
|
68
|
+
.WriteString(char.header.name, 16); //0x0014
|
|
69
|
+
}
|
|
70
|
+
writer
|
|
71
|
+
.WriteArray(_writeStatus(char.header.status)) //0x0024
|
|
72
|
+
.WriteUInt8(char.header.progression) //0x0025
|
|
73
|
+
.WriteUInt16(char.header.active_arms) //0x0026
|
|
74
|
+
.WriteUInt8(_classId(char.header.class, constants)) //0x0028
|
|
75
|
+
.WriteArray(new Uint8Array([0x10, 0x1e])) //0x0029
|
|
76
|
+
.WriteUInt8(char.header.level) //0x002b
|
|
77
|
+
.WriteArray(new Uint8Array([0x00, 0x00, 0x00, 0x00])) //0x002c
|
|
78
|
+
.WriteUInt32(char.header.last_played) //0x0030
|
|
79
|
+
.WriteArray(new Uint8Array([0xff, 0xff, 0xff, 0xff])) //0x0034
|
|
80
|
+
.WriteArray(_writeAssignedSkills(char.header.assigned_skills, constants)) //0x0038
|
|
81
|
+
.WriteUInt32(_skillId(char.header.left_skill, constants)) //0x0078
|
|
82
|
+
.WriteUInt32(_skillId(char.header.right_skill, constants)) //0x007c
|
|
83
|
+
.WriteUInt32(_skillId(char.header.left_swap_skill, constants)) //0x0080
|
|
84
|
+
.WriteUInt32(_skillId(char.header.right_swap_skill, constants)) //0x0084
|
|
85
|
+
.WriteArray(_writeCharMenuAppearance(char.header.menu_appearance, constants)) //0x0088 [char menu appearance]
|
|
86
|
+
.WriteArray(_writeDifficulty(char.header.difficulty)) //0x00a8
|
|
87
|
+
.WriteUInt32(char.header.map_id) //0x00ab
|
|
88
|
+
.WriteArray(new Uint8Array([0x00, 0x00])) //0x00af [unk = 0x0, 0x0]
|
|
89
|
+
.WriteUInt16(char.header.dead_merc) //0x00b1
|
|
90
|
+
.WriteUInt32(parseInt(char.header.merc_id, 16)) //0x00b3
|
|
91
|
+
.WriteUInt16(char.header.merc_name_id) //0x00b7
|
|
92
|
+
.WriteUInt16(char.header.merc_type) //0x00b9
|
|
93
|
+
.WriteUInt32(char.header.merc_experience); //0x00bb
|
|
94
|
+
if (char.header.version > 0x61) {
|
|
95
|
+
writer
|
|
96
|
+
.WriteArray(new Uint8Array(76)) //0x00bf [unk]
|
|
97
|
+
.WriteString(char.header.name, 16) //0x010b
|
|
98
|
+
.WriteArray(new Uint8Array(52)); //0x011b [unk]
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
writer
|
|
102
|
+
.WriteArray(new Uint8Array(140)) //0x00bf [unk]
|
|
103
|
+
.WriteUInt32(0x1); //0x014b [unk = 0x1, 0x0, 0x0, 0x0]
|
|
104
|
+
}
|
|
105
|
+
writer
|
|
106
|
+
.WriteString("Woo!", 4) //0x014f [quests = 0x57, 0x6f, 0x6f, 0x21 "Woo!"]
|
|
107
|
+
.WriteArray(new Uint8Array([0x06, 0x00, 0x00, 0x00, 0x2a, 0x01])) //0x0153 [unk = 0x6, 0x0, 0x0, 0x0, 0x2a, 0x1]
|
|
108
|
+
.WriteArray(_writeQuests(char.header.quests_normal)) //0x0159
|
|
109
|
+
.WriteArray(_writeQuests(char.header.quests_nm)) //0x01b9
|
|
110
|
+
.WriteArray(_writeQuests(char.header.quests_hell)) //0x0219
|
|
111
|
+
.WriteString("WS", 2) //0x0279 [waypoint data = 0x57, 0x53 "WS"]
|
|
112
|
+
.WriteArray(new Uint8Array([0x01, 0x00, 0x00, 0x00, 0x50, 0x00])) //0x027b [unk = 0x1, 0x0, 0x0, 0x0, 0x50, 0x0]
|
|
113
|
+
.WriteArray(_writeWaypointData(char.header.waypoints)) //0x0281
|
|
114
|
+
.WriteArray(new Uint8Array([0x01, 0x77])) //0x02c9 [npc header = 0x01, 0x77 ".w"]
|
|
115
|
+
.WriteUInt16(0x34) //0x02ca [npc struct length]
|
|
116
|
+
.WriteArray(_writeNPCData(char.header.npcs)); //0x02cc [npc introduction data... unk]
|
|
117
|
+
}
|
|
118
|
+
exports.writeHeader = writeHeader;
|
|
119
|
+
function _classId(name, constants) {
|
|
120
|
+
if (!name)
|
|
121
|
+
return -1;
|
|
122
|
+
return constants.classes.findIndex((c) => c && c.n == name);
|
|
123
|
+
}
|
|
124
|
+
function _skillId(name, constants) {
|
|
125
|
+
//default to "attack" if empty string or can't find spellname.
|
|
126
|
+
if (name === "")
|
|
127
|
+
return 0;
|
|
128
|
+
if (!name)
|
|
129
|
+
return -1;
|
|
130
|
+
const idx = constants.skills.findIndex((s) => s && s.s == name);
|
|
131
|
+
return idx >= 0 ? idx : 0;
|
|
132
|
+
}
|
|
133
|
+
function _readStatus(byte) {
|
|
134
|
+
const status = {};
|
|
135
|
+
status.hardcore = ((byte >>> 2) & 1) === 1;
|
|
136
|
+
status.died = ((byte >>> 3) & 1) === 1;
|
|
137
|
+
status.expansion = ((byte >>> 5) & 1) === 1;
|
|
138
|
+
status.ladder = ((byte >>> 6) & 1) === 1;
|
|
139
|
+
return status;
|
|
140
|
+
}
|
|
141
|
+
function _writeStatus(status) {
|
|
142
|
+
const arr = new Uint8Array(1);
|
|
143
|
+
arr[0] |= status.hardcore ? 1 << 2 : 0;
|
|
144
|
+
arr[0] |= status.died ? 1 << 3 : 0;
|
|
145
|
+
arr[0] |= status.expansion ? 1 << 5 : 0;
|
|
146
|
+
arr[0] |= status.ladder ? 1 << 6 : 0;
|
|
147
|
+
return arr;
|
|
148
|
+
}
|
|
149
|
+
function _readCharMenuAppearance(bytes, constants) {
|
|
150
|
+
const appearance = {};
|
|
151
|
+
const reader = new bitreader_1.BitReader(bytes);
|
|
152
|
+
const graphics = reader.ReadArray(16);
|
|
153
|
+
const tints = reader.ReadArray(16);
|
|
154
|
+
appearance.head = { graphic: graphics[0], tint: tints[0] };
|
|
155
|
+
appearance.torso = { graphic: graphics[1], tint: tints[1] };
|
|
156
|
+
appearance.legs = { graphic: graphics[2], tint: tints[2] };
|
|
157
|
+
appearance.right_arm = { graphic: graphics[3], tint: tints[3] };
|
|
158
|
+
appearance.left_arm = { graphic: graphics[4], tint: tints[4] };
|
|
159
|
+
appearance.right_hand = { graphic: graphics[5], tint: tints[5] };
|
|
160
|
+
appearance.left_hand = { graphic: graphics[6], tint: tints[6] };
|
|
161
|
+
appearance.shield = { graphic: graphics[7], tint: tints[7] };
|
|
162
|
+
appearance.special1 = { graphic: graphics[8], tint: tints[8] };
|
|
163
|
+
appearance.special2 = { graphic: graphics[9], tint: tints[9] };
|
|
164
|
+
appearance.special3 = { graphic: graphics[10], tint: tints[10] };
|
|
165
|
+
appearance.special4 = { graphic: graphics[11], tint: tints[11] };
|
|
166
|
+
appearance.special5 = { graphic: graphics[12], tint: tints[12] };
|
|
167
|
+
appearance.special6 = { graphic: graphics[13], tint: tints[13] };
|
|
168
|
+
appearance.special7 = { graphic: graphics[14], tint: tints[14] };
|
|
169
|
+
appearance.special8 = { graphic: graphics[15], tint: tints[15] };
|
|
170
|
+
return appearance;
|
|
171
|
+
}
|
|
172
|
+
function _writeCharMenuAppearance(appearance, constants) {
|
|
173
|
+
const writer = new bitwriter_1.BitWriter(32);
|
|
174
|
+
writer.length = 32 * 8;
|
|
175
|
+
const graphics = [];
|
|
176
|
+
graphics.push(appearance && appearance.head ? appearance.head.graphic : 0);
|
|
177
|
+
graphics.push(appearance && appearance.torso ? appearance.torso.graphic : 0);
|
|
178
|
+
graphics.push(appearance && appearance.legs ? appearance.legs.graphic : 0);
|
|
179
|
+
graphics.push(appearance && appearance.right_arm ? appearance.right_arm.graphic : 0);
|
|
180
|
+
graphics.push(appearance && appearance.left_arm ? appearance.left_arm.graphic : 0);
|
|
181
|
+
graphics.push(appearance && appearance.right_hand ? appearance.right_hand.graphic : 0);
|
|
182
|
+
graphics.push(appearance && appearance.left_hand ? appearance.left_hand.graphic : 0);
|
|
183
|
+
graphics.push(appearance && appearance.shield ? appearance.shield.graphic : 0);
|
|
184
|
+
graphics.push(appearance && appearance.special1 ? appearance.special1.graphic : 0);
|
|
185
|
+
graphics.push(appearance && appearance.special2 ? appearance.special2.graphic : 0);
|
|
186
|
+
graphics.push(appearance && appearance.special3 ? appearance.special3.graphic : 0);
|
|
187
|
+
graphics.push(appearance && appearance.special4 ? appearance.special4.graphic : 0);
|
|
188
|
+
graphics.push(appearance && appearance.special5 ? appearance.special5.graphic : 0);
|
|
189
|
+
graphics.push(appearance && appearance.special6 ? appearance.special6.graphic : 0);
|
|
190
|
+
graphics.push(appearance && appearance.special7 ? appearance.special7.graphic : 0);
|
|
191
|
+
graphics.push(appearance && appearance.special8 ? appearance.special8.graphic : 0);
|
|
192
|
+
for (const g of graphics) {
|
|
193
|
+
writer.WriteUInt8(g);
|
|
194
|
+
}
|
|
195
|
+
const tints = [];
|
|
196
|
+
tints.push(appearance && appearance.head ? appearance.head.tint : 0);
|
|
197
|
+
tints.push(appearance && appearance.torso ? appearance.torso.tint : 0);
|
|
198
|
+
tints.push(appearance && appearance.legs ? appearance.legs.tint : 0);
|
|
199
|
+
tints.push(appearance && appearance.right_arm ? appearance.right_arm.tint : 0);
|
|
200
|
+
tints.push(appearance && appearance.left_arm ? appearance.left_arm.tint : 0);
|
|
201
|
+
tints.push(appearance && appearance.right_hand ? appearance.right_hand.tint : 0);
|
|
202
|
+
tints.push(appearance && appearance.left_hand ? appearance.left_hand.tint : 0);
|
|
203
|
+
tints.push(appearance && appearance.shield ? appearance.shield.tint : 0);
|
|
204
|
+
tints.push(appearance && appearance.special1 ? appearance.special1.tint : 0);
|
|
205
|
+
tints.push(appearance && appearance.special2 ? appearance.special2.tint : 0);
|
|
206
|
+
tints.push(appearance && appearance.special3 ? appearance.special3.tint : 0);
|
|
207
|
+
tints.push(appearance && appearance.special4 ? appearance.special4.tint : 0);
|
|
208
|
+
tints.push(appearance && appearance.special5 ? appearance.special5.tint : 0);
|
|
209
|
+
tints.push(appearance && appearance.special6 ? appearance.special6.tint : 0);
|
|
210
|
+
tints.push(appearance && appearance.special7 ? appearance.special7.tint : 0);
|
|
211
|
+
tints.push(appearance && appearance.special8 ? appearance.special8.tint : 0);
|
|
212
|
+
for (const t of tints) {
|
|
213
|
+
writer.WriteUInt8(t);
|
|
214
|
+
}
|
|
215
|
+
return writer.ToArray();
|
|
216
|
+
}
|
|
217
|
+
function _readAssignedSkills(bytes, constants) {
|
|
218
|
+
const skills = [];
|
|
219
|
+
const reader = new bitreader_1.BitReader(bytes);
|
|
220
|
+
for (let i = 0; i < 16; i++) {
|
|
221
|
+
const skillId = reader.ReadUInt32();
|
|
222
|
+
const skill = constants.skills[skillId];
|
|
223
|
+
if (skill) {
|
|
224
|
+
skills.push(skill.s);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return skills;
|
|
228
|
+
}
|
|
229
|
+
function _writeAssignedSkills(skills, constants) {
|
|
230
|
+
const writer = new bitwriter_1.BitWriter(64);
|
|
231
|
+
writer.length = 64 * 8;
|
|
232
|
+
skills = skills || [];
|
|
233
|
+
for (let i = 0; i < 16; i++) {
|
|
234
|
+
const skillId = _skillId(skills[i], constants);
|
|
235
|
+
if (skillId > 0) {
|
|
236
|
+
writer.WriteUInt32(skillId);
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
writer.WriteUInt32(0xffff);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return writer.ToArray();
|
|
243
|
+
}
|
|
244
|
+
function _readDifficulty(bytes) {
|
|
245
|
+
const difficulty = {};
|
|
246
|
+
difficulty.Normal = bytes[0];
|
|
247
|
+
difficulty.Nightmare = bytes[1];
|
|
248
|
+
difficulty.Hell = bytes[2];
|
|
249
|
+
return difficulty;
|
|
250
|
+
}
|
|
251
|
+
function _writeDifficulty(difficulty) {
|
|
252
|
+
const writer = new bitwriter_1.BitWriter(3);
|
|
253
|
+
writer.length = 3 * 8;
|
|
254
|
+
writer.WriteUInt8(difficulty.Normal);
|
|
255
|
+
writer.WriteUInt8(difficulty.Nightmare);
|
|
256
|
+
writer.WriteUInt8(difficulty.Hell);
|
|
257
|
+
return writer.ToArray();
|
|
258
|
+
}
|
|
259
|
+
function _readQuests(bytes) {
|
|
260
|
+
const quests = {};
|
|
261
|
+
const reader = new bitreader_1.BitReader(bytes);
|
|
262
|
+
quests.act_i = {};
|
|
263
|
+
quests.act_i.introduced = reader.ReadUInt16() === 0x1; //0x0000
|
|
264
|
+
quests.act_i.den_of_evil = _readQuest(reader.ReadArray(2)); //0x0002
|
|
265
|
+
quests.act_i.sisters_burial_grounds = _readQuest(reader.ReadArray(2));
|
|
266
|
+
quests.act_i.tools_of_the_trade = _readQuest(reader.ReadArray(2));
|
|
267
|
+
quests.act_i.the_search_for_cain = _readQuest(reader.ReadArray(2));
|
|
268
|
+
quests.act_i.the_forgotten_tower = _readQuest(reader.ReadArray(2));
|
|
269
|
+
quests.act_i.sisters_to_the_slaughter = _readQuest(reader.ReadArray(2));
|
|
270
|
+
quests.act_i.completed = reader.ReadUInt16() === 0x1;
|
|
271
|
+
quests.act_ii = {};
|
|
272
|
+
quests.act_ii.introduced = reader.ReadUInt16() === 0x1; //0x0010 [if jerhyn introduction = 0x01]
|
|
273
|
+
quests.act_ii.radaments_lair = _readQuest(reader.ReadArray(2)); //0x0012
|
|
274
|
+
quests.act_ii.the_horadric_staff = _readQuest(reader.ReadArray(2));
|
|
275
|
+
quests.act_ii.tainted_sun = _readQuest(reader.ReadArray(2));
|
|
276
|
+
quests.act_ii.arcane_sanctuary = _readQuest(reader.ReadArray(2));
|
|
277
|
+
quests.act_ii.the_summoner = _readQuest(reader.ReadArray(2));
|
|
278
|
+
quests.act_ii.the_seven_tombs = _readQuest(reader.ReadArray(2));
|
|
279
|
+
quests.act_ii.completed = reader.ReadUInt16() === 0x1; //0x001e
|
|
280
|
+
quests.act_iii = {};
|
|
281
|
+
quests.act_iii.introduced = reader.ReadUInt16() === 0x1; //0x0020 [if hratli introduction = 0x01]
|
|
282
|
+
quests.act_iii.lam_esens_tome = _readQuest(reader.ReadArray(2)); //0x0022
|
|
283
|
+
quests.act_iii.khalims_will = _readQuest(reader.ReadArray(2));
|
|
284
|
+
quests.act_iii.blade_of_the_old_religion = _readQuest(reader.ReadArray(2));
|
|
285
|
+
quests.act_iii.the_golden_bird = _readQuest(reader.ReadArray(2));
|
|
286
|
+
quests.act_iii.the_blackened_temple = _readQuest(reader.ReadArray(2));
|
|
287
|
+
quests.act_iii.the_guardian = _readQuest(reader.ReadArray(2));
|
|
288
|
+
quests.act_iii.completed = reader.ReadUInt16() === 0x1; //0x002e
|
|
289
|
+
quests.act_iv = {};
|
|
290
|
+
quests.act_iv.introduced = reader.ReadUInt16() === 0x1; //0x0030 [if activ introduction = 0x01]
|
|
291
|
+
quests.act_iv.the_fallen_angel = _readQuest(reader.ReadArray(2)); //0x0032
|
|
292
|
+
quests.act_iv.terrors_end = _readQuest(reader.ReadArray(2));
|
|
293
|
+
quests.act_iv.hellforge = _readQuest(reader.ReadArray(2));
|
|
294
|
+
quests.act_iv.completed = reader.ReadUInt16() === 0x1; //0x0038
|
|
295
|
+
reader.SkipBytes(10); //0x003a
|
|
296
|
+
quests.act_v = {};
|
|
297
|
+
quests.act_v.introduced = reader.ReadUInt16() === 0x1;
|
|
298
|
+
quests.act_v.siege_on_harrogath = _readQuest(reader.ReadArray(2)); //0x0046
|
|
299
|
+
quests.act_v.rescue_on_mount_arreat = _readQuest(reader.ReadArray(2));
|
|
300
|
+
quests.act_v.prison_of_ice = _readQuest(reader.ReadArray(2));
|
|
301
|
+
quests.act_v.betrayal_of_harrogath = _readQuest(reader.ReadArray(2));
|
|
302
|
+
quests.act_v.rite_of_passage = _readQuest(reader.ReadArray(2));
|
|
303
|
+
quests.act_v.eve_of_destruction = _readQuest(reader.ReadArray(2));
|
|
304
|
+
quests.act_v.completed = reader.ReadUInt16() === 0x1;
|
|
305
|
+
reader.SkipBytes(12);
|
|
306
|
+
return quests; //sizeof [0x0060]
|
|
307
|
+
}
|
|
308
|
+
function _writeQuests(quests) {
|
|
309
|
+
const writer = new bitwriter_1.BitWriter(96);
|
|
310
|
+
writer.length = 96 * 8;
|
|
311
|
+
const difficultyCompleted = +quests.act_v.completed || +quests.act_v.eve_of_destruction.is_completed;
|
|
312
|
+
return writer
|
|
313
|
+
.WriteUInt16(+quests.act_i.introduced)
|
|
314
|
+
.WriteArray(_writeQuest(quests.act_i.den_of_evil))
|
|
315
|
+
.WriteArray(_writeQuest(quests.act_i.sisters_burial_grounds))
|
|
316
|
+
.WriteArray(_writeQuest(quests.act_i.tools_of_the_trade))
|
|
317
|
+
.WriteArray(_writeQuest(quests.act_i.the_search_for_cain))
|
|
318
|
+
.WriteArray(_writeQuest(quests.act_i.the_forgotten_tower))
|
|
319
|
+
.WriteArray(_writeQuest(quests.act_i.sisters_to_the_slaughter))
|
|
320
|
+
.WriteUInt16(+quests.act_i.completed || +quests.act_i.sisters_to_the_slaughter.is_completed)
|
|
321
|
+
.WriteUInt16(+quests.act_ii.introduced || +quests.act_i.sisters_to_the_slaughter.is_completed)
|
|
322
|
+
.WriteArray(_writeQuest(quests.act_ii.radaments_lair))
|
|
323
|
+
.WriteArray(_writeQuest(quests.act_ii.the_horadric_staff))
|
|
324
|
+
.WriteArray(_writeQuest(quests.act_ii.tainted_sun))
|
|
325
|
+
.WriteArray(_writeQuest(quests.act_ii.arcane_sanctuary))
|
|
326
|
+
.WriteArray(_writeQuest(quests.act_ii.the_summoner))
|
|
327
|
+
.WriteArray(_writeQuest(quests.act_ii.the_seven_tombs))
|
|
328
|
+
.WriteUInt16(+quests.act_ii.completed || +quests.act_ii.the_seven_tombs.is_completed)
|
|
329
|
+
.WriteUInt16(+quests.act_iii.introduced || +quests.act_ii.the_seven_tombs.is_completed)
|
|
330
|
+
.WriteArray(_writeQuest(quests.act_iii.lam_esens_tome))
|
|
331
|
+
.WriteArray(_writeQuest(quests.act_iii.khalims_will))
|
|
332
|
+
.WriteArray(_writeQuest(quests.act_iii.blade_of_the_old_religion))
|
|
333
|
+
.WriteArray(_writeQuest(quests.act_iii.the_golden_bird))
|
|
334
|
+
.WriteArray(_writeQuest(quests.act_iii.the_blackened_temple))
|
|
335
|
+
.WriteArray(_writeQuest(quests.act_iii.the_guardian))
|
|
336
|
+
.WriteUInt16(+quests.act_iii.completed || +quests.act_iii.the_guardian.is_completed)
|
|
337
|
+
.WriteUInt16(+quests.act_iv.introduced || +quests.act_iii.the_guardian.is_completed)
|
|
338
|
+
.WriteArray(_writeQuest(quests.act_iv.the_fallen_angel))
|
|
339
|
+
.WriteArray(_writeQuest(quests.act_iv.terrors_end))
|
|
340
|
+
.WriteArray(_writeQuest(quests.act_iv.hellforge))
|
|
341
|
+
.WriteUInt16(+quests.act_iv.completed || +quests.act_iv.terrors_end.is_completed)
|
|
342
|
+
.WriteArray(new Uint8Array(6))
|
|
343
|
+
.WriteUInt16(+quests.act_v.introduced || +quests.act_iv.terrors_end.is_completed)
|
|
344
|
+
.WriteArray(new Uint8Array(4))
|
|
345
|
+
.WriteArray(_writeQuest(quests.act_v.siege_on_harrogath))
|
|
346
|
+
.WriteArray(_writeQuest(quests.act_v.rescue_on_mount_arreat))
|
|
347
|
+
.WriteArray(_writeQuest(quests.act_v.prison_of_ice))
|
|
348
|
+
.WriteArray(_writeQuest(quests.act_v.betrayal_of_harrogath))
|
|
349
|
+
.WriteArray(_writeQuest(quests.act_v.rite_of_passage))
|
|
350
|
+
.WriteArray(_writeQuest(quests.act_v.eve_of_destruction))
|
|
351
|
+
.WriteUInt8(difficultyCompleted)
|
|
352
|
+
.WriteUInt8(difficultyCompleted ? 0x80 : 0x0) //is this right?
|
|
353
|
+
.WriteArray(new Uint8Array(12))
|
|
354
|
+
.ToArray();
|
|
355
|
+
}
|
|
356
|
+
function _readQuest(bytes) {
|
|
357
|
+
const quest = {};
|
|
358
|
+
const reader = new bitreader_1.BitReader(bytes);
|
|
359
|
+
quest.is_completed = reader.ReadBit() === 1;
|
|
360
|
+
quest.is_requirement_completed = reader.ReadBit() === 1;
|
|
361
|
+
quest.is_received = reader.ReadBit() === 1;
|
|
362
|
+
if (reader.ReadBit() === 1)
|
|
363
|
+
quest.unk3 = true;
|
|
364
|
+
if (reader.ReadBit() === 1)
|
|
365
|
+
quest.unk4 = true;
|
|
366
|
+
if (reader.ReadBit() === 1)
|
|
367
|
+
quest.unk5 = true;
|
|
368
|
+
if (reader.ReadBit() === 1)
|
|
369
|
+
quest.unk6 = true;
|
|
370
|
+
if (reader.ReadBit() === 1)
|
|
371
|
+
quest.consumed_scroll = true;
|
|
372
|
+
if (reader.ReadBit() === 1)
|
|
373
|
+
quest.unk8 = true;
|
|
374
|
+
if (reader.ReadBit() === 1)
|
|
375
|
+
quest.unk9 = true;
|
|
376
|
+
if (reader.ReadBit() === 1)
|
|
377
|
+
quest.unk10 = true;
|
|
378
|
+
if (reader.ReadBit() === 1)
|
|
379
|
+
quest.unk11 = true;
|
|
380
|
+
quest.closed = reader.ReadBit() === 1;
|
|
381
|
+
quest.done_recently = reader.ReadBit() === 1;
|
|
382
|
+
if (reader.ReadBit() === 1)
|
|
383
|
+
quest.unk14 = true;
|
|
384
|
+
if (reader.ReadBit() === 1)
|
|
385
|
+
quest.unk15 = true;
|
|
386
|
+
return quest;
|
|
387
|
+
}
|
|
388
|
+
function _writeQuest(quest) {
|
|
389
|
+
const writer = new bitwriter_1.BitWriter(2);
|
|
390
|
+
writer.length = 2 * 8;
|
|
391
|
+
writer.WriteBit(+quest.is_completed);
|
|
392
|
+
writer.WriteBit(+quest.is_requirement_completed);
|
|
393
|
+
writer.WriteBit(+quest.is_received);
|
|
394
|
+
writer.WriteBit(+quest.unk3);
|
|
395
|
+
writer.WriteBit(+quest.unk4);
|
|
396
|
+
writer.WriteBit(+quest.unk5);
|
|
397
|
+
writer.WriteBit(+quest.unk6);
|
|
398
|
+
writer.WriteBit(+quest.consumed_scroll);
|
|
399
|
+
writer.WriteBit(+quest.unk8);
|
|
400
|
+
writer.WriteBit(+quest.unk9);
|
|
401
|
+
writer.WriteBit(+quest.unk10);
|
|
402
|
+
writer.WriteBit(+quest.unk11);
|
|
403
|
+
writer.WriteBit(+quest.closed);
|
|
404
|
+
writer.WriteBit(+quest.done_recently);
|
|
405
|
+
writer.WriteBit(+quest.unk14);
|
|
406
|
+
writer.WriteBit(+quest.unk15);
|
|
407
|
+
return writer.ToArray();
|
|
408
|
+
}
|
|
409
|
+
function _readWaypointData(bytes) {
|
|
410
|
+
const waypoints = {};
|
|
411
|
+
const reader = new bitreader_1.BitReader(bytes);
|
|
412
|
+
for (let i = 0; i < difficulties.length; i++) {
|
|
413
|
+
waypoints[difficulties[i]] = _readWaypoints(reader.ReadArray(24));
|
|
414
|
+
}
|
|
415
|
+
return waypoints;
|
|
416
|
+
}
|
|
417
|
+
function _readWaypoints(bytes) {
|
|
418
|
+
const waypoints = {};
|
|
419
|
+
const reader = new bitreader_1.BitReader(bytes);
|
|
420
|
+
reader.SkipBytes(2); //unk = 0x2, 0x
|
|
421
|
+
waypoints.act_i = {};
|
|
422
|
+
waypoints.act_i.rogue_encampement = reader.ReadBit() === 1;
|
|
423
|
+
waypoints.act_i.cold_plains = reader.ReadBit() === 1;
|
|
424
|
+
waypoints.act_i.stony_field = reader.ReadBit() === 1;
|
|
425
|
+
waypoints.act_i.dark_woods = reader.ReadBit() === 1;
|
|
426
|
+
waypoints.act_i.black_marsh = reader.ReadBit() === 1;
|
|
427
|
+
waypoints.act_i.outer_cloister = reader.ReadBit() === 1;
|
|
428
|
+
waypoints.act_i.jail_lvl_1 = reader.ReadBit() === 1;
|
|
429
|
+
waypoints.act_i.inner_cloister = reader.ReadBit() === 1;
|
|
430
|
+
waypoints.act_i.catacombs_lvl_2 = reader.ReadBit() === 1;
|
|
431
|
+
waypoints.act_ii = {};
|
|
432
|
+
waypoints.act_ii.lut_gholein = reader.ReadBit() === 1;
|
|
433
|
+
waypoints.act_ii.sewers_lvl_2 = reader.ReadBit() === 1;
|
|
434
|
+
waypoints.act_ii.dry_hills = reader.ReadBit() === 1;
|
|
435
|
+
waypoints.act_ii.halls_of_the_dead_lvl_2 = reader.ReadBit() === 1;
|
|
436
|
+
waypoints.act_ii.far_oasis = reader.ReadBit() === 1;
|
|
437
|
+
waypoints.act_ii.lost_city = reader.ReadBit() === 1;
|
|
438
|
+
waypoints.act_ii.palace_cellar_lvl_1 = reader.ReadBit() === 1;
|
|
439
|
+
waypoints.act_ii.arcane_sanctuary = reader.ReadBit() === 1;
|
|
440
|
+
waypoints.act_ii.canyon_of_the_magi = reader.ReadBit() === 1;
|
|
441
|
+
waypoints.act_iii = {};
|
|
442
|
+
waypoints.act_iii.kurast_docks = reader.ReadBit() === 1;
|
|
443
|
+
waypoints.act_iii.spider_forest = reader.ReadBit() === 1;
|
|
444
|
+
waypoints.act_iii.great_marsh = reader.ReadBit() === 1;
|
|
445
|
+
waypoints.act_iii.flayer_jungle = reader.ReadBit() === 1;
|
|
446
|
+
waypoints.act_iii.lower_kurast = reader.ReadBit() === 1;
|
|
447
|
+
waypoints.act_iii.kurast_bazaar = reader.ReadBit() === 1;
|
|
448
|
+
waypoints.act_iii.upper_kurast = reader.ReadBit() === 1;
|
|
449
|
+
waypoints.act_iii.travincal = reader.ReadBit() === 1;
|
|
450
|
+
waypoints.act_iii.durance_of_hate_lvl_2 = reader.ReadBit() === 1;
|
|
451
|
+
waypoints.act_iv = {};
|
|
452
|
+
waypoints.act_iv.the_pandemonium_fortress = reader.ReadBit() === 1;
|
|
453
|
+
waypoints.act_iv.city_of_the_damned = reader.ReadBit() === 1;
|
|
454
|
+
waypoints.act_iv.river_of_flame = reader.ReadBit() === 1;
|
|
455
|
+
waypoints.act_v = {};
|
|
456
|
+
waypoints.act_v.harrogath = reader.ReadBit() === 1;
|
|
457
|
+
waypoints.act_v.frigid_highlands = reader.ReadBit() === 1;
|
|
458
|
+
waypoints.act_v.arreat_plateau = reader.ReadBit() === 1;
|
|
459
|
+
waypoints.act_v.crystalline_passage = reader.ReadBit() === 1;
|
|
460
|
+
waypoints.act_v.halls_of_pain = reader.ReadBit() === 1;
|
|
461
|
+
waypoints.act_v.glacial_trail = reader.ReadBit() === 1;
|
|
462
|
+
waypoints.act_v.frozen_tundra = reader.ReadBit() === 1;
|
|
463
|
+
waypoints.act_v.the_ancients_way = reader.ReadBit() === 1;
|
|
464
|
+
waypoints.act_v.worldstone_keep_lvl_2 = reader.ReadBit() === 1;
|
|
465
|
+
reader.Align().SkipBytes(17);
|
|
466
|
+
return waypoints;
|
|
467
|
+
}
|
|
468
|
+
function _writeWaypointData(waypoints) {
|
|
469
|
+
const writer = new bitwriter_1.BitWriter(72);
|
|
470
|
+
writer.length = 72 * 8;
|
|
471
|
+
for (let i = 0; i < difficulties.length; i++) {
|
|
472
|
+
const w = waypoints != null ? waypoints[difficulties[i]] : null;
|
|
473
|
+
writer.WriteArray(_writeWaypoints(w));
|
|
474
|
+
}
|
|
475
|
+
return writer.ToArray();
|
|
476
|
+
}
|
|
477
|
+
function _writeWaypoints(waypoints) {
|
|
478
|
+
const writer = new bitwriter_1.BitWriter(24);
|
|
479
|
+
writer.length = 24 * 8;
|
|
480
|
+
writer.WriteArray(new Uint8Array([0x02, 0x01]));
|
|
481
|
+
if (waypoints) {
|
|
482
|
+
if (waypoints.act_i) {
|
|
483
|
+
writer.WriteBit(+waypoints.act_i.rogue_encampement);
|
|
484
|
+
writer.WriteBit(+waypoints.act_i.cold_plains);
|
|
485
|
+
writer.WriteBit(+waypoints.act_i.stony_field);
|
|
486
|
+
writer.WriteBit(+waypoints.act_i.dark_woods);
|
|
487
|
+
writer.WriteBit(+waypoints.act_i.black_marsh);
|
|
488
|
+
writer.WriteBit(+waypoints.act_i.outer_cloister);
|
|
489
|
+
writer.WriteBit(+waypoints.act_i.jail_lvl_1);
|
|
490
|
+
writer.WriteBit(+waypoints.act_i.inner_cloister);
|
|
491
|
+
writer.WriteBit(+waypoints.act_i.catacombs_lvl_2);
|
|
492
|
+
}
|
|
493
|
+
if (waypoints.act_ii) {
|
|
494
|
+
writer.WriteBit(+waypoints.act_ii.lut_gholein);
|
|
495
|
+
writer.WriteBit(+waypoints.act_ii.sewers_lvl_2);
|
|
496
|
+
writer.WriteBit(+waypoints.act_ii.dry_hills);
|
|
497
|
+
writer.WriteBit(+waypoints.act_ii.halls_of_the_dead_lvl_2);
|
|
498
|
+
writer.WriteBit(+waypoints.act_ii.far_oasis);
|
|
499
|
+
writer.WriteBit(+waypoints.act_ii.lost_city);
|
|
500
|
+
writer.WriteBit(+waypoints.act_ii.palace_cellar_lvl_1);
|
|
501
|
+
writer.WriteBit(+waypoints.act_ii.arcane_sanctuary);
|
|
502
|
+
writer.WriteBit(+waypoints.act_ii.canyon_of_the_magi);
|
|
503
|
+
}
|
|
504
|
+
if (waypoints.act_iii) {
|
|
505
|
+
writer.WriteBit(+waypoints.act_iii.kurast_docks);
|
|
506
|
+
writer.WriteBit(+waypoints.act_iii.spider_forest);
|
|
507
|
+
writer.WriteBit(+waypoints.act_iii.great_marsh);
|
|
508
|
+
writer.WriteBit(+waypoints.act_iii.flayer_jungle);
|
|
509
|
+
writer.WriteBit(+waypoints.act_iii.lower_kurast);
|
|
510
|
+
writer.WriteBit(+waypoints.act_iii.kurast_bazaar);
|
|
511
|
+
writer.WriteBit(+waypoints.act_iii.upper_kurast);
|
|
512
|
+
writer.WriteBit(+waypoints.act_iii.travincal);
|
|
513
|
+
writer.WriteBit(+waypoints.act_iii.durance_of_hate_lvl_2);
|
|
514
|
+
}
|
|
515
|
+
if (waypoints.act_iv) {
|
|
516
|
+
writer.WriteBit(+waypoints.act_iv.the_pandemonium_fortress);
|
|
517
|
+
writer.WriteBit(+waypoints.act_iv.city_of_the_damned);
|
|
518
|
+
writer.WriteBit(+waypoints.act_iv.river_of_flame);
|
|
519
|
+
}
|
|
520
|
+
if (waypoints.act_v) {
|
|
521
|
+
writer.WriteBit(+waypoints.act_v.harrogath);
|
|
522
|
+
writer.WriteBit(+waypoints.act_v.frigid_highlands);
|
|
523
|
+
writer.WriteBit(+waypoints.act_v.arreat_plateau);
|
|
524
|
+
writer.WriteBit(+waypoints.act_v.crystalline_passage);
|
|
525
|
+
writer.WriteBit(+waypoints.act_v.halls_of_pain);
|
|
526
|
+
writer.WriteBit(+waypoints.act_v.glacial_trail);
|
|
527
|
+
writer.WriteBit(+waypoints.act_v.frozen_tundra);
|
|
528
|
+
writer.WriteBit(+waypoints.act_v.the_ancients_way);
|
|
529
|
+
writer.WriteBit(+waypoints.act_v.worldstone_keep_lvl_2);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
//all wps
|
|
534
|
+
//writer.WriteArray(new Uint8Array(5));
|
|
535
|
+
writer.WriteArray(new Uint8Array([0xff, 0xff, 0xff, 0xff, 0x7f]));
|
|
536
|
+
//_writeBits(writer, 0x3fffffffff, start, 0, 38);
|
|
537
|
+
}
|
|
538
|
+
writer.Align().WriteArray(new Uint8Array(17));
|
|
539
|
+
return writer.ToArray();
|
|
540
|
+
}
|
|
541
|
+
function _readNPCData(bytes) {
|
|
542
|
+
const npcs = { normal: {}, nm: {}, hell: {} };
|
|
543
|
+
const reader = new bitreader_1.BitReader(bytes);
|
|
544
|
+
for (let j = 0; j < 3; j++) {
|
|
545
|
+
npcs[difficulties[j]] = {
|
|
546
|
+
warriv_act_ii: { intro: false, congrats: false },
|
|
547
|
+
charsi: { intro: false, congrats: false },
|
|
548
|
+
warriv_act_i: { intro: false, congrats: false },
|
|
549
|
+
kashya: { intro: false, congrats: false },
|
|
550
|
+
akara: { intro: false, congrats: false },
|
|
551
|
+
gheed: { intro: false, congrats: false },
|
|
552
|
+
greiz: { intro: false, congrats: false },
|
|
553
|
+
jerhyn: { intro: false, congrats: false },
|
|
554
|
+
meshif_act_ii: { intro: false, congrats: false },
|
|
555
|
+
geglash: { intro: false, congrats: false },
|
|
556
|
+
lysnader: { intro: false, congrats: false },
|
|
557
|
+
fara: { intro: false, congrats: false },
|
|
558
|
+
drogan: { intro: false, congrats: false },
|
|
559
|
+
alkor: { intro: false, congrats: false },
|
|
560
|
+
hratli: { intro: false, congrats: false },
|
|
561
|
+
ashera: { intro: false, congrats: false },
|
|
562
|
+
cain_act_iii: { intro: false, congrats: false },
|
|
563
|
+
elzix: { intro: false, congrats: false },
|
|
564
|
+
malah: { intro: false, congrats: false },
|
|
565
|
+
anya: { intro: false, congrats: false },
|
|
566
|
+
natalya: { intro: false, congrats: false },
|
|
567
|
+
meshif_act_iii: { intro: false, congrats: false },
|
|
568
|
+
ormus: { intro: false, congrats: false },
|
|
569
|
+
cain_act_v: { intro: false, congrats: false },
|
|
570
|
+
qualkehk: { intro: false, congrats: false },
|
|
571
|
+
nihlathak: { intro: false, congrats: false },
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
//introductions
|
|
575
|
+
for (let i = 0; i < 3; i++) {
|
|
576
|
+
const j = i * 5;
|
|
577
|
+
const npc = npcs[difficulties[i]];
|
|
578
|
+
npc.warriv_act_ii.intro = reader.bits[0 + j * 8] === 1;
|
|
579
|
+
npc.charsi.intro = reader.bits[2 + j * 8] === 1;
|
|
580
|
+
npc.warriv_act_i.intro = reader.bits[3 + j * 8] === 1;
|
|
581
|
+
npc.kashya.intro = reader.bits[4 + j * 8] === 1;
|
|
582
|
+
npc.akara.intro = reader.bits[5 + j * 8] === 1;
|
|
583
|
+
npc.gheed.intro = reader.bits[6 + j * 8] === 1;
|
|
584
|
+
npc.greiz.intro = reader.bits[8 + j * 8] === 1;
|
|
585
|
+
npc.jerhyn.intro = reader.bits[9 + j * 8] === 1;
|
|
586
|
+
npc.meshif_act_ii.intro = reader.bits[10 + j * 8] === 1;
|
|
587
|
+
npc.geglash.intro = reader.bits[11 + j * 8] === 1;
|
|
588
|
+
npc.lysnader.intro = reader.bits[12 + j * 8] === 1;
|
|
589
|
+
npc.fara.intro = reader.bits[13 + j * 8] === 1;
|
|
590
|
+
npc.drogan.intro = reader.bits[14 + j * 8] === 1;
|
|
591
|
+
npc.alkor.intro = reader.bits[16 + j * 8] === 1;
|
|
592
|
+
npc.hratli.intro = reader.bits[17 + j * 8] === 1;
|
|
593
|
+
npc.ashera.intro = reader.bits[18 + j * 8] === 1;
|
|
594
|
+
npc.cain_act_iii.intro = reader.bits[21 + j * 8] === 1;
|
|
595
|
+
npc.elzix.intro = reader.bits[23 + j * 8] === 1;
|
|
596
|
+
npc.malah.intro = reader.bits[24 + j * 8] === 1;
|
|
597
|
+
npc.anya.intro = reader.bits[25 + j * 8] === 1;
|
|
598
|
+
npc.natalya.intro = reader.bits[27 + j * 8] === 1;
|
|
599
|
+
npc.meshif_act_iii.intro = reader.bits[28 + j * 8] === 1;
|
|
600
|
+
npc.ormus.intro = reader.bits[31 + j * 8] === 1;
|
|
601
|
+
npc.cain_act_v.intro = reader.bits[37 + j * 8] === 1;
|
|
602
|
+
npc.qualkehk.intro = reader.bits[38 + j * 8] === 1;
|
|
603
|
+
npc.nihlathak.intro = reader.bits[39 + j * 8] === 1;
|
|
604
|
+
}
|
|
605
|
+
//congrats
|
|
606
|
+
for (let i = 0; i < 3; i++) {
|
|
607
|
+
const j = i * 5;
|
|
608
|
+
const npc = npcs[difficulties[i]];
|
|
609
|
+
npc.warriv_act_ii.congrats = reader.bits[192 + (0 + j * 8)] === 1;
|
|
610
|
+
npc.charsi.congrats = reader.bits[192 + (2 + j * 8)] === 1;
|
|
611
|
+
npc.warriv_act_i.congrats = reader.bits[192 + (3 + j * 8)] === 1;
|
|
612
|
+
npc.kashya.congrats = reader.bits[192 + (4 + j * 8)] === 1;
|
|
613
|
+
npc.akara.congrats = reader.bits[192 + (5 + j * 8)] === 1;
|
|
614
|
+
npc.gheed.congrats = reader.bits[192 + (6 + j * 8)] === 1;
|
|
615
|
+
npc.greiz.congrats = reader.bits[192 + (8 + j * 8)] === 1;
|
|
616
|
+
npc.jerhyn.congrats = reader.bits[192 + (9 + j * 8)] === 1;
|
|
617
|
+
npc.meshif_act_ii.congrats = reader.bits[192 + (10 + j * 8)] === 1;
|
|
618
|
+
npc.geglash.congrats = reader.bits[192 + (11 + j * 8)] === 1;
|
|
619
|
+
npc.lysnader.congrats = reader.bits[192 + (12 + j * 8)] === 1;
|
|
620
|
+
npc.fara.congrats = reader.bits[192 + (13 + j * 8)] === 1;
|
|
621
|
+
npc.drogan.congrats = reader.bits[192 + (14 + j * 8)] === 1;
|
|
622
|
+
npc.alkor.congrats = reader.bits[192 + (16 + j * 8)] === 1;
|
|
623
|
+
npc.hratli.congrats = reader.bits[192 + (17 + j * 8)] === 1;
|
|
624
|
+
npc.ashera.congrats = reader.bits[192 + (18 + j * 8)] === 1;
|
|
625
|
+
npc.cain_act_iii.congrats = reader.bits[192 + (21 + j * 8)] === 1;
|
|
626
|
+
npc.elzix.congrats = reader.bits[192 + (23 + j * 8)] === 1;
|
|
627
|
+
npc.malah.congrats = reader.bits[192 + (24 + j * 8)] === 1;
|
|
628
|
+
npc.anya.congrats = reader.bits[192 + (25 + j * 8)] === 1;
|
|
629
|
+
npc.natalya.congrats = reader.bits[192 + (27 + j * 8)] === 1;
|
|
630
|
+
npc.meshif_act_iii.congrats = reader.bits[192 + (28 + j * 8)] === 1;
|
|
631
|
+
npc.ormus.congrats = reader.bits[192 + (31 + j * 8)] === 1;
|
|
632
|
+
npc.cain_act_v.congrats = reader.bits[192 + (37 + j * 8)] === 1;
|
|
633
|
+
npc.qualkehk.congrats = reader.bits[192 + (38 + j * 8)] === 1;
|
|
634
|
+
npc.nihlathak.congrats = reader.bits[192 + (39 + j * 8)] === 1;
|
|
635
|
+
}
|
|
636
|
+
return npcs;
|
|
637
|
+
}
|
|
638
|
+
function _writeNPCData(npcs) {
|
|
639
|
+
const writer = new bitwriter_1.BitWriter(0x30);
|
|
640
|
+
writer.length = 0x30 * 8;
|
|
641
|
+
if (npcs) {
|
|
642
|
+
for (let j = 0; j < 3; j++) {
|
|
643
|
+
const npc = npcs[difficulties[j]];
|
|
644
|
+
writer.SeekByte(j * 5);
|
|
645
|
+
writer.WriteBit(+npc.warriv_act_ii.intro);
|
|
646
|
+
writer.WriteBit(0);
|
|
647
|
+
writer.WriteBit(+npc.charsi.intro);
|
|
648
|
+
writer.WriteBit(+npc.warriv_act_i.intro);
|
|
649
|
+
writer.WriteBit(+npc.kashya.intro);
|
|
650
|
+
writer.WriteBit(+npc.akara.intro);
|
|
651
|
+
writer.WriteBit(+npc.gheed.intro);
|
|
652
|
+
writer.WriteBit(0);
|
|
653
|
+
writer.WriteBit(+npc.greiz.intro);
|
|
654
|
+
writer.WriteBit(+npc.jerhyn.intro);
|
|
655
|
+
writer.WriteBit(+npc.meshif_act_ii.intro);
|
|
656
|
+
writer.WriteBit(+npc.geglash.intro);
|
|
657
|
+
writer.WriteBit(+npc.lysnader.intro);
|
|
658
|
+
writer.WriteBit(+npc.fara.intro);
|
|
659
|
+
writer.WriteBit(+npc.drogan.intro);
|
|
660
|
+
writer.WriteBit(0);
|
|
661
|
+
writer.WriteBit(+npc.alkor.intro);
|
|
662
|
+
writer.WriteBit(+npc.hratli.intro);
|
|
663
|
+
writer.WriteBit(+npc.ashera.intro);
|
|
664
|
+
writer.WriteBits(new Uint8Array(2).fill(0), 2);
|
|
665
|
+
writer.WriteBit(+npc.cain_act_iii.intro);
|
|
666
|
+
writer.WriteBit(0);
|
|
667
|
+
writer.WriteBit(+npc.elzix.intro);
|
|
668
|
+
writer.WriteBit(+npc.malah.intro);
|
|
669
|
+
writer.WriteBit(+npc.anya.intro);
|
|
670
|
+
writer.WriteBit(0);
|
|
671
|
+
writer.WriteBit(+npc.natalya.intro);
|
|
672
|
+
writer.WriteBit(+npc.meshif_act_iii.intro);
|
|
673
|
+
writer.WriteBits(new Uint8Array(2).fill(0), 2);
|
|
674
|
+
writer.WriteBit(+npc.ormus.intro);
|
|
675
|
+
writer.WriteBits(new Uint8Array(5).fill(0), 5);
|
|
676
|
+
writer.WriteBit(+npc.cain_act_v.intro);
|
|
677
|
+
writer.WriteBit(+npc.qualkehk.intro);
|
|
678
|
+
writer.WriteBit(+npc.nihlathak.intro);
|
|
679
|
+
}
|
|
680
|
+
for (let j = 0; j < 3; j++) {
|
|
681
|
+
writer.SeekByte(24 + j * 5);
|
|
682
|
+
const npc = npcs[difficulties[j]];
|
|
683
|
+
writer.WriteBit(+npc.warriv_act_ii.congrats);
|
|
684
|
+
writer.WriteBit(0);
|
|
685
|
+
writer.WriteBit(+npc.charsi.congrats);
|
|
686
|
+
writer.WriteBit(+npc.warriv_act_i.congrats);
|
|
687
|
+
writer.WriteBit(+npc.kashya.congrats);
|
|
688
|
+
writer.WriteBit(+npc.akara.congrats);
|
|
689
|
+
writer.WriteBit(+npc.gheed.congrats);
|
|
690
|
+
writer.WriteBit(0);
|
|
691
|
+
writer.WriteBit(+npc.greiz.congrats);
|
|
692
|
+
writer.WriteBit(+npc.jerhyn.congrats);
|
|
693
|
+
writer.WriteBit(+npc.meshif_act_ii.congrats);
|
|
694
|
+
writer.WriteBit(+npc.geglash.congrats);
|
|
695
|
+
writer.WriteBit(+npc.lysnader.congrats);
|
|
696
|
+
writer.WriteBit(+npc.fara.congrats);
|
|
697
|
+
writer.WriteBit(+npc.drogan.congrats);
|
|
698
|
+
writer.WriteBit(0);
|
|
699
|
+
writer.WriteBit(+npc.alkor.congrats);
|
|
700
|
+
writer.WriteBit(+npc.hratli.congrats);
|
|
701
|
+
writer.WriteBit(+npc.ashera.congrats);
|
|
702
|
+
writer.WriteBits(new Uint8Array(2).fill(0), 2);
|
|
703
|
+
writer.WriteBit(+npc.cain_act_iii.congrats);
|
|
704
|
+
writer.WriteBit(0);
|
|
705
|
+
writer.WriteBit(+npc.elzix.congrats);
|
|
706
|
+
writer.WriteBit(+npc.malah.congrats);
|
|
707
|
+
writer.WriteBit(+npc.anya.congrats);
|
|
708
|
+
writer.WriteBit(0);
|
|
709
|
+
writer.WriteBit(+npc.natalya.congrats);
|
|
710
|
+
writer.WriteBit(+npc.meshif_act_iii.congrats);
|
|
711
|
+
writer.WriteBits(new Uint8Array(2).fill(0), 2);
|
|
712
|
+
writer.WriteBit(+npc.ormus.congrats);
|
|
713
|
+
writer.WriteBits(new Uint8Array(5).fill(0), 5);
|
|
714
|
+
writer.WriteBit(+npc.cain_act_v.congrats);
|
|
715
|
+
writer.WriteBit(+npc.qualkehk.congrats);
|
|
716
|
+
writer.WriteBit(+npc.nihlathak.congrats);
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
return writer.ToArray();
|
|
720
|
+
}
|
|
721
|
+
//# sourceMappingURL=default_header.js.map
|