@rhyster/wow-casc-dbc 2.6.18 → 2.6.19
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/dist/index.cjs +71 -107
- package/dist/index.mjs +71 -107
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -19,18 +19,12 @@ const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
|
19
19
|
const http__default = /*#__PURE__*/_interopDefaultCompat(http);
|
|
20
20
|
const path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
21
21
|
|
|
22
|
-
var __defProp$6 = Object.defineProperty;
|
|
23
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
24
|
-
var __publicField$6 = (obj, key, value) => {
|
|
25
|
-
__defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
26
|
-
return value;
|
|
27
|
-
};
|
|
28
22
|
const ADB_MAGIC = 1481004104;
|
|
29
23
|
class ADBReader {
|
|
24
|
+
build;
|
|
25
|
+
entries = [];
|
|
26
|
+
tableEntries = /* @__PURE__ */ new Map();
|
|
30
27
|
constructor(buffer) {
|
|
31
|
-
__publicField$6(this, "build");
|
|
32
|
-
__publicField$6(this, "entries", []);
|
|
33
|
-
__publicField$6(this, "tableEntries", /* @__PURE__ */ new Map());
|
|
34
28
|
const magic = buffer.readUInt32BE(0);
|
|
35
29
|
assert__default(magic === ADB_MAGIC, `[ADB]: Invalid magic: ${magic.toString(16).padStart(8, "0")}`);
|
|
36
30
|
const version = buffer.readUInt32LE(4);
|
|
@@ -70,21 +64,15 @@ class ADBReader {
|
|
|
70
64
|
}
|
|
71
65
|
}
|
|
72
66
|
|
|
73
|
-
var __defProp$5 = Object.defineProperty;
|
|
74
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
75
|
-
var __publicField$5 = (obj, key, value) => {
|
|
76
|
-
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
77
|
-
return value;
|
|
78
|
-
};
|
|
79
67
|
class Salsa20 {
|
|
68
|
+
fixed;
|
|
69
|
+
key;
|
|
70
|
+
nonce;
|
|
71
|
+
counter = new Uint32Array([0, 0]);
|
|
72
|
+
state = new Uint32Array(16);
|
|
73
|
+
block = new Uint8Array(64);
|
|
74
|
+
position = 0;
|
|
80
75
|
constructor(key, nonce) {
|
|
81
|
-
__publicField$5(this, "fixed");
|
|
82
|
-
__publicField$5(this, "key");
|
|
83
|
-
__publicField$5(this, "nonce");
|
|
84
|
-
__publicField$5(this, "counter", new Uint32Array([0, 0]));
|
|
85
|
-
__publicField$5(this, "state", new Uint32Array(16));
|
|
86
|
-
__publicField$5(this, "block", new Uint8Array(64));
|
|
87
|
-
__publicField$5(this, "position", 0);
|
|
88
76
|
assert__default(key.length === 32 || key.length === 16, "Salsa20 requires 128-bit or 256-bit key");
|
|
89
77
|
assert__default(nonce.length === 8, "Salsa20 requires 64-bit nonce");
|
|
90
78
|
this.key = new Uint32Array(8);
|
|
@@ -188,23 +176,17 @@ class Salsa20 {
|
|
|
188
176
|
}
|
|
189
177
|
}
|
|
190
178
|
|
|
191
|
-
var __defProp$4 = Object.defineProperty;
|
|
192
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
193
|
-
var __publicField$4 = (obj, key, value) => {
|
|
194
|
-
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
195
|
-
return value;
|
|
196
|
-
};
|
|
197
179
|
const BLTE_MAGIC = 1112298565;
|
|
198
180
|
const ENC_TYPE_SALSA20 = 83;
|
|
199
181
|
const EMPTY_HASH = "00000000000000000000000000000000";
|
|
200
182
|
class BLTEReader {
|
|
183
|
+
buffer;
|
|
184
|
+
blte;
|
|
185
|
+
blocks = [];
|
|
186
|
+
keys;
|
|
187
|
+
processedBlock = 0;
|
|
188
|
+
processedOffset = 0;
|
|
201
189
|
constructor(buffer, eKey, keys = /* @__PURE__ */ new Map()) {
|
|
202
|
-
__publicField$4(this, "buffer");
|
|
203
|
-
__publicField$4(this, "blte");
|
|
204
|
-
__publicField$4(this, "blocks", []);
|
|
205
|
-
__publicField$4(this, "keys");
|
|
206
|
-
__publicField$4(this, "processedBlock", 0);
|
|
207
|
-
__publicField$4(this, "processedOffset", 0);
|
|
208
190
|
this.blte = buffer;
|
|
209
191
|
this.buffer = Buffer.alloc(0);
|
|
210
192
|
this.keys = keys;
|
|
@@ -344,17 +326,11 @@ class BLTEReader {
|
|
|
344
326
|
}
|
|
345
327
|
}
|
|
346
328
|
|
|
347
|
-
var __defProp$3 = Object.defineProperty;
|
|
348
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
349
|
-
var __publicField$3 = (obj, key, value) => {
|
|
350
|
-
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
351
|
-
return value;
|
|
352
|
-
};
|
|
353
329
|
class Store {
|
|
330
|
+
data;
|
|
331
|
+
dataFile;
|
|
332
|
+
promise;
|
|
354
333
|
constructor(dataFile) {
|
|
355
|
-
__publicField$3(this, "data");
|
|
356
|
-
__publicField$3(this, "dataFile");
|
|
357
|
-
__publicField$3(this, "promise");
|
|
358
334
|
this.dataFile = dataFile;
|
|
359
335
|
this.data = {};
|
|
360
336
|
this.promise = new Promise((resolve) => {
|
|
@@ -445,7 +421,7 @@ const downloadFile = (prefixes, type, key, {
|
|
|
445
421
|
return urls.reduce(
|
|
446
422
|
(prev, url, index) => prev.catch((err) => {
|
|
447
423
|
if (showAttemptFail === true && index > 0 && err instanceof Error) {
|
|
448
|
-
console.warn(`${( new Date()).toISOString()} [WARN]:`, err.message);
|
|
424
|
+
console.warn(`${(/* @__PURE__ */ new Date()).toISOString()} [WARN]:`, err.message);
|
|
449
425
|
}
|
|
450
426
|
return requestData(url, { partialOffset, partialLength, showProgress });
|
|
451
427
|
}),
|
|
@@ -561,26 +537,37 @@ const hashlittle2 = (key, pc = 0, pb = 0) => {
|
|
|
561
537
|
switch (length - offset) {
|
|
562
538
|
case 12:
|
|
563
539
|
c += key.charCodeAt(offset + 11) << 24;
|
|
540
|
+
// falls through
|
|
564
541
|
case 11:
|
|
565
542
|
c += key.charCodeAt(offset + 10) << 16;
|
|
543
|
+
// falls through
|
|
566
544
|
case 10:
|
|
567
545
|
c += key.charCodeAt(offset + 9) << 8;
|
|
546
|
+
// falls through
|
|
568
547
|
case 9:
|
|
569
548
|
c += key.charCodeAt(offset + 8);
|
|
549
|
+
// falls through
|
|
570
550
|
case 8:
|
|
571
551
|
b += key.charCodeAt(offset + 7) << 24;
|
|
552
|
+
// falls through
|
|
572
553
|
case 7:
|
|
573
554
|
b += key.charCodeAt(offset + 6) << 16;
|
|
555
|
+
// falls through
|
|
574
556
|
case 6:
|
|
575
557
|
b += key.charCodeAt(offset + 5) << 8;
|
|
558
|
+
// falls through
|
|
576
559
|
case 5:
|
|
577
560
|
b += key.charCodeAt(offset + 4);
|
|
561
|
+
// falls through
|
|
578
562
|
case 4:
|
|
579
563
|
a += key.charCodeAt(offset + 3) << 24;
|
|
564
|
+
// falls through
|
|
580
565
|
case 3:
|
|
581
566
|
a += key.charCodeAt(offset + 2) << 16;
|
|
567
|
+
// falls through
|
|
582
568
|
case 2:
|
|
583
569
|
a += key.charCodeAt(offset + 1) << 8;
|
|
570
|
+
// falls through
|
|
584
571
|
case 1:
|
|
585
572
|
a += key.charCodeAt(offset + 0);
|
|
586
573
|
}
|
|
@@ -974,18 +961,14 @@ const JEDEC = [
|
|
|
974
961
|
"YB"
|
|
975
962
|
];
|
|
976
963
|
const formatFileSize = (input) => {
|
|
977
|
-
if (Number.isNaN(input))
|
|
978
|
-
return "";
|
|
964
|
+
if (Number.isNaN(input)) return "";
|
|
979
965
|
let size = Number(input);
|
|
980
966
|
const isNegative = size < 0;
|
|
981
967
|
const result = [];
|
|
982
|
-
if (isNegative)
|
|
983
|
-
size = -size;
|
|
968
|
+
if (isNegative) size = -size;
|
|
984
969
|
let exponent = Math.floor(Math.log(size) / Math.log(1024));
|
|
985
|
-
if (exponent < 0)
|
|
986
|
-
|
|
987
|
-
if (exponent > 8)
|
|
988
|
-
exponent = 8;
|
|
970
|
+
if (exponent < 0) exponent = 0;
|
|
971
|
+
if (exponent > 8) exponent = 8;
|
|
989
972
|
if (size === 0) {
|
|
990
973
|
result[0] = 0;
|
|
991
974
|
result[1] = JEDEC[exponent];
|
|
@@ -998,8 +981,7 @@ const formatFileSize = (input) => {
|
|
|
998
981
|
}
|
|
999
982
|
result[1] = JEDEC[exponent];
|
|
1000
983
|
}
|
|
1001
|
-
if (isNegative)
|
|
1002
|
-
result[0] = -result[0];
|
|
984
|
+
if (isNegative) result[0] = -result[0];
|
|
1003
985
|
return result.join(" ");
|
|
1004
986
|
};
|
|
1005
987
|
const resolveCDNHost = async (hosts, path) => {
|
|
@@ -1018,12 +1000,6 @@ const resolveCDNHost = async (hosts, path) => {
|
|
|
1018
1000
|
return resolved.map((result) => `http://${result.host}/${path}`);
|
|
1019
1001
|
};
|
|
1020
1002
|
|
|
1021
|
-
var __defProp$2 = Object.defineProperty;
|
|
1022
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1023
|
-
var __publicField$2 = (obj, key, value) => {
|
|
1024
|
-
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1025
|
-
return value;
|
|
1026
|
-
};
|
|
1027
1003
|
const WDC5_MAGIC = 1464091445;
|
|
1028
1004
|
const readBitpackedValue = (buffer, fieldOffsetBits, fieldSizeBits, signed = false) => {
|
|
1029
1005
|
const offsetBytes = fieldOffsetBits >>> 3;
|
|
@@ -1043,18 +1019,18 @@ const readBitpackedValue = (buffer, fieldOffsetBits, fieldSizeBits, signed = fal
|
|
|
1043
1019
|
return signed ? BigInt.asIntN(fieldSizeBits, value >> BigInt(bitOffset)) : BigInt.asUintN(fieldSizeBits, value >> BigInt(bitOffset));
|
|
1044
1020
|
};
|
|
1045
1021
|
class WDCReader {
|
|
1022
|
+
tableHash;
|
|
1023
|
+
layoutHash;
|
|
1024
|
+
locale;
|
|
1025
|
+
isNormal;
|
|
1026
|
+
hasRelationshipData;
|
|
1027
|
+
fields;
|
|
1028
|
+
fieldsInfo;
|
|
1029
|
+
rows = /* @__PURE__ */ new Map();
|
|
1030
|
+
relationships = /* @__PURE__ */ new Map();
|
|
1031
|
+
copyTable = /* @__PURE__ */ new Map();
|
|
1032
|
+
hotfixes = /* @__PURE__ */ new Map();
|
|
1046
1033
|
constructor(buffer, blocks = [], adb) {
|
|
1047
|
-
__publicField$2(this, "tableHash");
|
|
1048
|
-
__publicField$2(this, "layoutHash");
|
|
1049
|
-
__publicField$2(this, "locale");
|
|
1050
|
-
__publicField$2(this, "isNormal");
|
|
1051
|
-
__publicField$2(this, "hasRelationshipData");
|
|
1052
|
-
__publicField$2(this, "fields");
|
|
1053
|
-
__publicField$2(this, "fieldsInfo");
|
|
1054
|
-
__publicField$2(this, "rows", /* @__PURE__ */ new Map());
|
|
1055
|
-
__publicField$2(this, "relationships", /* @__PURE__ */ new Map());
|
|
1056
|
-
__publicField$2(this, "copyTable", /* @__PURE__ */ new Map());
|
|
1057
|
-
__publicField$2(this, "hotfixes", /* @__PURE__ */ new Map());
|
|
1058
1034
|
const magic = buffer.readUInt32BE(0);
|
|
1059
1035
|
const fieldCount = buffer.readUInt32LE(140);
|
|
1060
1036
|
const recordSize = buffer.readUInt32LE(144);
|
|
@@ -1511,12 +1487,6 @@ class WDCReader {
|
|
|
1511
1487
|
}
|
|
1512
1488
|
}
|
|
1513
1489
|
|
|
1514
|
-
var __defProp$1 = Object.defineProperty;
|
|
1515
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1516
|
-
var __publicField$1 = (obj, key, value) => {
|
|
1517
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1518
|
-
return value;
|
|
1519
|
-
};
|
|
1520
1490
|
var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
1521
1491
|
LogLevel2[LogLevel2["error"] = 0] = "error";
|
|
1522
1492
|
LogLevel2[LogLevel2["warn"] = 1] = "warn";
|
|
@@ -1531,30 +1501,36 @@ const textLogLevel = [
|
|
|
1531
1501
|
"DEBUG"
|
|
1532
1502
|
];
|
|
1533
1503
|
class CASCClient {
|
|
1504
|
+
region;
|
|
1505
|
+
product;
|
|
1506
|
+
version;
|
|
1507
|
+
name2FileDataID = /* @__PURE__ */ new Map();
|
|
1508
|
+
keys = /* @__PURE__ */ new Map();
|
|
1509
|
+
preload;
|
|
1510
|
+
static async getProductVersion(region, product) {
|
|
1511
|
+
const versionsText = await getProductVersions(region, product);
|
|
1512
|
+
const versions = parseProductVersions(versionsText);
|
|
1513
|
+
return versions.find((version) => version.Region === region);
|
|
1514
|
+
}
|
|
1515
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1516
|
+
static LocaleFlags = LocaleFlags;
|
|
1517
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1518
|
+
static ContentFlags = ContentFlags;
|
|
1519
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1520
|
+
static LogLevel = LogLevel;
|
|
1521
|
+
logLevel;
|
|
1534
1522
|
constructor(region, product, version, logLevel = 2 /* info */) {
|
|
1535
|
-
__publicField$1(this, "region");
|
|
1536
|
-
__publicField$1(this, "product");
|
|
1537
|
-
__publicField$1(this, "version");
|
|
1538
|
-
__publicField$1(this, "name2FileDataID", /* @__PURE__ */ new Map());
|
|
1539
|
-
__publicField$1(this, "keys", /* @__PURE__ */ new Map());
|
|
1540
|
-
__publicField$1(this, "preload");
|
|
1541
|
-
__publicField$1(this, "logLevel");
|
|
1542
1523
|
this.region = region;
|
|
1543
1524
|
this.product = product;
|
|
1544
1525
|
this.version = version;
|
|
1545
1526
|
this.logLevel = logLevel;
|
|
1546
1527
|
}
|
|
1547
|
-
static async getProductVersion(region, product) {
|
|
1548
|
-
const versionsText = await getProductVersions(region, product);
|
|
1549
|
-
const versions = parseProductVersions(versionsText);
|
|
1550
|
-
return versions.find((version) => version.Region === region);
|
|
1551
|
-
}
|
|
1552
1528
|
log(level, message) {
|
|
1553
1529
|
if (level <= this.logLevel) {
|
|
1554
1530
|
if (level <= 0 /* error */) {
|
|
1555
|
-
console.error(`${( new Date()).toISOString()} [${textLogLevel[level]}]:`, message);
|
|
1531
|
+
console.error(`${(/* @__PURE__ */ new Date()).toISOString()} [${textLogLevel[level]}]:`, message);
|
|
1556
1532
|
} else {
|
|
1557
|
-
console.info(`${( new Date()).toISOString()} [${textLogLevel[level]}]:`, message);
|
|
1533
|
+
console.info(`${(/* @__PURE__ */ new Date()).toISOString()} [${textLogLevel[level]}]:`, message);
|
|
1558
1534
|
}
|
|
1559
1535
|
}
|
|
1560
1536
|
}
|
|
@@ -1781,19 +1757,7 @@ class CASCClient {
|
|
|
1781
1757
|
};
|
|
1782
1758
|
}
|
|
1783
1759
|
}
|
|
1784
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1785
|
-
__publicField$1(CASCClient, "LocaleFlags", LocaleFlags);
|
|
1786
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1787
|
-
__publicField$1(CASCClient, "ContentFlags", ContentFlags);
|
|
1788
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1789
|
-
__publicField$1(CASCClient, "LogLevel", LogLevel);
|
|
1790
1760
|
|
|
1791
|
-
var __defProp = Object.defineProperty;
|
|
1792
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1793
|
-
var __publicField = (obj, key, value) => {
|
|
1794
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1795
|
-
return value;
|
|
1796
|
-
};
|
|
1797
1761
|
const PATTERN_COLUMN = /^(int|float|locstring|string)(<[^:]+::[^>]+>)?\s([^\s]+)/;
|
|
1798
1762
|
const PATTERN_LAYOUT = /^LAYOUT\s(.*)/;
|
|
1799
1763
|
const PATTERN_FIELD = /^(\$([^$]+)\$)?([^<[]+)(<(u|)(\d+)>)?(\[(\d+)\])?$/;
|
|
@@ -1835,11 +1799,11 @@ const getCastBuffer = (value, srcSize, dstSize) => {
|
|
|
1835
1799
|
return castBuffer;
|
|
1836
1800
|
};
|
|
1837
1801
|
class DBDParser {
|
|
1802
|
+
wdc;
|
|
1803
|
+
definitions = /* @__PURE__ */ new Map();
|
|
1804
|
+
columns = [];
|
|
1805
|
+
cache = /* @__PURE__ */ new Map();
|
|
1838
1806
|
constructor(wdc) {
|
|
1839
|
-
__publicField(this, "wdc");
|
|
1840
|
-
__publicField(this, "definitions", /* @__PURE__ */ new Map());
|
|
1841
|
-
__publicField(this, "columns", []);
|
|
1842
|
-
__publicField(this, "cache", /* @__PURE__ */ new Map());
|
|
1843
1807
|
this.wdc = wdc;
|
|
1844
1808
|
}
|
|
1845
1809
|
async init() {
|
package/dist/index.mjs
CHANGED
|
@@ -7,18 +7,12 @@ import fs from 'node:fs/promises';
|
|
|
7
7
|
import http from 'node:http';
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
|
|
10
|
-
var __defProp$6 = Object.defineProperty;
|
|
11
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __publicField$6 = (obj, key, value) => {
|
|
13
|
-
__defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14
|
-
return value;
|
|
15
|
-
};
|
|
16
10
|
const ADB_MAGIC = 1481004104;
|
|
17
11
|
class ADBReader {
|
|
12
|
+
build;
|
|
13
|
+
entries = [];
|
|
14
|
+
tableEntries = /* @__PURE__ */ new Map();
|
|
18
15
|
constructor(buffer) {
|
|
19
|
-
__publicField$6(this, "build");
|
|
20
|
-
__publicField$6(this, "entries", []);
|
|
21
|
-
__publicField$6(this, "tableEntries", /* @__PURE__ */ new Map());
|
|
22
16
|
const magic = buffer.readUInt32BE(0);
|
|
23
17
|
assert(magic === ADB_MAGIC, `[ADB]: Invalid magic: ${magic.toString(16).padStart(8, "0")}`);
|
|
24
18
|
const version = buffer.readUInt32LE(4);
|
|
@@ -58,21 +52,15 @@ class ADBReader {
|
|
|
58
52
|
}
|
|
59
53
|
}
|
|
60
54
|
|
|
61
|
-
var __defProp$5 = Object.defineProperty;
|
|
62
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
63
|
-
var __publicField$5 = (obj, key, value) => {
|
|
64
|
-
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
65
|
-
return value;
|
|
66
|
-
};
|
|
67
55
|
class Salsa20 {
|
|
56
|
+
fixed;
|
|
57
|
+
key;
|
|
58
|
+
nonce;
|
|
59
|
+
counter = new Uint32Array([0, 0]);
|
|
60
|
+
state = new Uint32Array(16);
|
|
61
|
+
block = new Uint8Array(64);
|
|
62
|
+
position = 0;
|
|
68
63
|
constructor(key, nonce) {
|
|
69
|
-
__publicField$5(this, "fixed");
|
|
70
|
-
__publicField$5(this, "key");
|
|
71
|
-
__publicField$5(this, "nonce");
|
|
72
|
-
__publicField$5(this, "counter", new Uint32Array([0, 0]));
|
|
73
|
-
__publicField$5(this, "state", new Uint32Array(16));
|
|
74
|
-
__publicField$5(this, "block", new Uint8Array(64));
|
|
75
|
-
__publicField$5(this, "position", 0);
|
|
76
64
|
assert(key.length === 32 || key.length === 16, "Salsa20 requires 128-bit or 256-bit key");
|
|
77
65
|
assert(nonce.length === 8, "Salsa20 requires 64-bit nonce");
|
|
78
66
|
this.key = new Uint32Array(8);
|
|
@@ -176,23 +164,17 @@ class Salsa20 {
|
|
|
176
164
|
}
|
|
177
165
|
}
|
|
178
166
|
|
|
179
|
-
var __defProp$4 = Object.defineProperty;
|
|
180
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
181
|
-
var __publicField$4 = (obj, key, value) => {
|
|
182
|
-
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
183
|
-
return value;
|
|
184
|
-
};
|
|
185
167
|
const BLTE_MAGIC = 1112298565;
|
|
186
168
|
const ENC_TYPE_SALSA20 = 83;
|
|
187
169
|
const EMPTY_HASH = "00000000000000000000000000000000";
|
|
188
170
|
class BLTEReader {
|
|
171
|
+
buffer;
|
|
172
|
+
blte;
|
|
173
|
+
blocks = [];
|
|
174
|
+
keys;
|
|
175
|
+
processedBlock = 0;
|
|
176
|
+
processedOffset = 0;
|
|
189
177
|
constructor(buffer, eKey, keys = /* @__PURE__ */ new Map()) {
|
|
190
|
-
__publicField$4(this, "buffer");
|
|
191
|
-
__publicField$4(this, "blte");
|
|
192
|
-
__publicField$4(this, "blocks", []);
|
|
193
|
-
__publicField$4(this, "keys");
|
|
194
|
-
__publicField$4(this, "processedBlock", 0);
|
|
195
|
-
__publicField$4(this, "processedOffset", 0);
|
|
196
178
|
this.blte = buffer;
|
|
197
179
|
this.buffer = Buffer.alloc(0);
|
|
198
180
|
this.keys = keys;
|
|
@@ -332,17 +314,11 @@ class BLTEReader {
|
|
|
332
314
|
}
|
|
333
315
|
}
|
|
334
316
|
|
|
335
|
-
var __defProp$3 = Object.defineProperty;
|
|
336
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
337
|
-
var __publicField$3 = (obj, key, value) => {
|
|
338
|
-
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
339
|
-
return value;
|
|
340
|
-
};
|
|
341
317
|
class Store {
|
|
318
|
+
data;
|
|
319
|
+
dataFile;
|
|
320
|
+
promise;
|
|
342
321
|
constructor(dataFile) {
|
|
343
|
-
__publicField$3(this, "data");
|
|
344
|
-
__publicField$3(this, "dataFile");
|
|
345
|
-
__publicField$3(this, "promise");
|
|
346
322
|
this.dataFile = dataFile;
|
|
347
323
|
this.data = {};
|
|
348
324
|
this.promise = new Promise((resolve) => {
|
|
@@ -433,7 +409,7 @@ const downloadFile = (prefixes, type, key, {
|
|
|
433
409
|
return urls.reduce(
|
|
434
410
|
(prev, url, index) => prev.catch((err) => {
|
|
435
411
|
if (showAttemptFail === true && index > 0 && err instanceof Error) {
|
|
436
|
-
console.warn(`${( new Date()).toISOString()} [WARN]:`, err.message);
|
|
412
|
+
console.warn(`${(/* @__PURE__ */ new Date()).toISOString()} [WARN]:`, err.message);
|
|
437
413
|
}
|
|
438
414
|
return requestData(url, { partialOffset, partialLength, showProgress });
|
|
439
415
|
}),
|
|
@@ -549,26 +525,37 @@ const hashlittle2 = (key, pc = 0, pb = 0) => {
|
|
|
549
525
|
switch (length - offset) {
|
|
550
526
|
case 12:
|
|
551
527
|
c += key.charCodeAt(offset + 11) << 24;
|
|
528
|
+
// falls through
|
|
552
529
|
case 11:
|
|
553
530
|
c += key.charCodeAt(offset + 10) << 16;
|
|
531
|
+
// falls through
|
|
554
532
|
case 10:
|
|
555
533
|
c += key.charCodeAt(offset + 9) << 8;
|
|
534
|
+
// falls through
|
|
556
535
|
case 9:
|
|
557
536
|
c += key.charCodeAt(offset + 8);
|
|
537
|
+
// falls through
|
|
558
538
|
case 8:
|
|
559
539
|
b += key.charCodeAt(offset + 7) << 24;
|
|
540
|
+
// falls through
|
|
560
541
|
case 7:
|
|
561
542
|
b += key.charCodeAt(offset + 6) << 16;
|
|
543
|
+
// falls through
|
|
562
544
|
case 6:
|
|
563
545
|
b += key.charCodeAt(offset + 5) << 8;
|
|
546
|
+
// falls through
|
|
564
547
|
case 5:
|
|
565
548
|
b += key.charCodeAt(offset + 4);
|
|
549
|
+
// falls through
|
|
566
550
|
case 4:
|
|
567
551
|
a += key.charCodeAt(offset + 3) << 24;
|
|
552
|
+
// falls through
|
|
568
553
|
case 3:
|
|
569
554
|
a += key.charCodeAt(offset + 2) << 16;
|
|
555
|
+
// falls through
|
|
570
556
|
case 2:
|
|
571
557
|
a += key.charCodeAt(offset + 1) << 8;
|
|
558
|
+
// falls through
|
|
572
559
|
case 1:
|
|
573
560
|
a += key.charCodeAt(offset + 0);
|
|
574
561
|
}
|
|
@@ -962,18 +949,14 @@ const JEDEC = [
|
|
|
962
949
|
"YB"
|
|
963
950
|
];
|
|
964
951
|
const formatFileSize = (input) => {
|
|
965
|
-
if (Number.isNaN(input))
|
|
966
|
-
return "";
|
|
952
|
+
if (Number.isNaN(input)) return "";
|
|
967
953
|
let size = Number(input);
|
|
968
954
|
const isNegative = size < 0;
|
|
969
955
|
const result = [];
|
|
970
|
-
if (isNegative)
|
|
971
|
-
size = -size;
|
|
956
|
+
if (isNegative) size = -size;
|
|
972
957
|
let exponent = Math.floor(Math.log(size) / Math.log(1024));
|
|
973
|
-
if (exponent < 0)
|
|
974
|
-
|
|
975
|
-
if (exponent > 8)
|
|
976
|
-
exponent = 8;
|
|
958
|
+
if (exponent < 0) exponent = 0;
|
|
959
|
+
if (exponent > 8) exponent = 8;
|
|
977
960
|
if (size === 0) {
|
|
978
961
|
result[0] = 0;
|
|
979
962
|
result[1] = JEDEC[exponent];
|
|
@@ -986,8 +969,7 @@ const formatFileSize = (input) => {
|
|
|
986
969
|
}
|
|
987
970
|
result[1] = JEDEC[exponent];
|
|
988
971
|
}
|
|
989
|
-
if (isNegative)
|
|
990
|
-
result[0] = -result[0];
|
|
972
|
+
if (isNegative) result[0] = -result[0];
|
|
991
973
|
return result.join(" ");
|
|
992
974
|
};
|
|
993
975
|
const resolveCDNHost = async (hosts, path) => {
|
|
@@ -1006,12 +988,6 @@ const resolveCDNHost = async (hosts, path) => {
|
|
|
1006
988
|
return resolved.map((result) => `http://${result.host}/${path}`);
|
|
1007
989
|
};
|
|
1008
990
|
|
|
1009
|
-
var __defProp$2 = Object.defineProperty;
|
|
1010
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1011
|
-
var __publicField$2 = (obj, key, value) => {
|
|
1012
|
-
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1013
|
-
return value;
|
|
1014
|
-
};
|
|
1015
991
|
const WDC5_MAGIC = 1464091445;
|
|
1016
992
|
const readBitpackedValue = (buffer, fieldOffsetBits, fieldSizeBits, signed = false) => {
|
|
1017
993
|
const offsetBytes = fieldOffsetBits >>> 3;
|
|
@@ -1031,18 +1007,18 @@ const readBitpackedValue = (buffer, fieldOffsetBits, fieldSizeBits, signed = fal
|
|
|
1031
1007
|
return signed ? BigInt.asIntN(fieldSizeBits, value >> BigInt(bitOffset)) : BigInt.asUintN(fieldSizeBits, value >> BigInt(bitOffset));
|
|
1032
1008
|
};
|
|
1033
1009
|
class WDCReader {
|
|
1010
|
+
tableHash;
|
|
1011
|
+
layoutHash;
|
|
1012
|
+
locale;
|
|
1013
|
+
isNormal;
|
|
1014
|
+
hasRelationshipData;
|
|
1015
|
+
fields;
|
|
1016
|
+
fieldsInfo;
|
|
1017
|
+
rows = /* @__PURE__ */ new Map();
|
|
1018
|
+
relationships = /* @__PURE__ */ new Map();
|
|
1019
|
+
copyTable = /* @__PURE__ */ new Map();
|
|
1020
|
+
hotfixes = /* @__PURE__ */ new Map();
|
|
1034
1021
|
constructor(buffer, blocks = [], adb) {
|
|
1035
|
-
__publicField$2(this, "tableHash");
|
|
1036
|
-
__publicField$2(this, "layoutHash");
|
|
1037
|
-
__publicField$2(this, "locale");
|
|
1038
|
-
__publicField$2(this, "isNormal");
|
|
1039
|
-
__publicField$2(this, "hasRelationshipData");
|
|
1040
|
-
__publicField$2(this, "fields");
|
|
1041
|
-
__publicField$2(this, "fieldsInfo");
|
|
1042
|
-
__publicField$2(this, "rows", /* @__PURE__ */ new Map());
|
|
1043
|
-
__publicField$2(this, "relationships", /* @__PURE__ */ new Map());
|
|
1044
|
-
__publicField$2(this, "copyTable", /* @__PURE__ */ new Map());
|
|
1045
|
-
__publicField$2(this, "hotfixes", /* @__PURE__ */ new Map());
|
|
1046
1022
|
const magic = buffer.readUInt32BE(0);
|
|
1047
1023
|
const fieldCount = buffer.readUInt32LE(140);
|
|
1048
1024
|
const recordSize = buffer.readUInt32LE(144);
|
|
@@ -1499,12 +1475,6 @@ class WDCReader {
|
|
|
1499
1475
|
}
|
|
1500
1476
|
}
|
|
1501
1477
|
|
|
1502
|
-
var __defProp$1 = Object.defineProperty;
|
|
1503
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1504
|
-
var __publicField$1 = (obj, key, value) => {
|
|
1505
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1506
|
-
return value;
|
|
1507
|
-
};
|
|
1508
1478
|
var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
1509
1479
|
LogLevel2[LogLevel2["error"] = 0] = "error";
|
|
1510
1480
|
LogLevel2[LogLevel2["warn"] = 1] = "warn";
|
|
@@ -1519,30 +1489,36 @@ const textLogLevel = [
|
|
|
1519
1489
|
"DEBUG"
|
|
1520
1490
|
];
|
|
1521
1491
|
class CASCClient {
|
|
1492
|
+
region;
|
|
1493
|
+
product;
|
|
1494
|
+
version;
|
|
1495
|
+
name2FileDataID = /* @__PURE__ */ new Map();
|
|
1496
|
+
keys = /* @__PURE__ */ new Map();
|
|
1497
|
+
preload;
|
|
1498
|
+
static async getProductVersion(region, product) {
|
|
1499
|
+
const versionsText = await getProductVersions(region, product);
|
|
1500
|
+
const versions = parseProductVersions(versionsText);
|
|
1501
|
+
return versions.find((version) => version.Region === region);
|
|
1502
|
+
}
|
|
1503
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1504
|
+
static LocaleFlags = LocaleFlags;
|
|
1505
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1506
|
+
static ContentFlags = ContentFlags;
|
|
1507
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1508
|
+
static LogLevel = LogLevel;
|
|
1509
|
+
logLevel;
|
|
1522
1510
|
constructor(region, product, version, logLevel = 2 /* info */) {
|
|
1523
|
-
__publicField$1(this, "region");
|
|
1524
|
-
__publicField$1(this, "product");
|
|
1525
|
-
__publicField$1(this, "version");
|
|
1526
|
-
__publicField$1(this, "name2FileDataID", /* @__PURE__ */ new Map());
|
|
1527
|
-
__publicField$1(this, "keys", /* @__PURE__ */ new Map());
|
|
1528
|
-
__publicField$1(this, "preload");
|
|
1529
|
-
__publicField$1(this, "logLevel");
|
|
1530
1511
|
this.region = region;
|
|
1531
1512
|
this.product = product;
|
|
1532
1513
|
this.version = version;
|
|
1533
1514
|
this.logLevel = logLevel;
|
|
1534
1515
|
}
|
|
1535
|
-
static async getProductVersion(region, product) {
|
|
1536
|
-
const versionsText = await getProductVersions(region, product);
|
|
1537
|
-
const versions = parseProductVersions(versionsText);
|
|
1538
|
-
return versions.find((version) => version.Region === region);
|
|
1539
|
-
}
|
|
1540
1516
|
log(level, message) {
|
|
1541
1517
|
if (level <= this.logLevel) {
|
|
1542
1518
|
if (level <= 0 /* error */) {
|
|
1543
|
-
console.error(`${( new Date()).toISOString()} [${textLogLevel[level]}]:`, message);
|
|
1519
|
+
console.error(`${(/* @__PURE__ */ new Date()).toISOString()} [${textLogLevel[level]}]:`, message);
|
|
1544
1520
|
} else {
|
|
1545
|
-
console.info(`${( new Date()).toISOString()} [${textLogLevel[level]}]:`, message);
|
|
1521
|
+
console.info(`${(/* @__PURE__ */ new Date()).toISOString()} [${textLogLevel[level]}]:`, message);
|
|
1546
1522
|
}
|
|
1547
1523
|
}
|
|
1548
1524
|
}
|
|
@@ -1769,19 +1745,7 @@ class CASCClient {
|
|
|
1769
1745
|
};
|
|
1770
1746
|
}
|
|
1771
1747
|
}
|
|
1772
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1773
|
-
__publicField$1(CASCClient, "LocaleFlags", LocaleFlags);
|
|
1774
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1775
|
-
__publicField$1(CASCClient, "ContentFlags", ContentFlags);
|
|
1776
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1777
|
-
__publicField$1(CASCClient, "LogLevel", LogLevel);
|
|
1778
1748
|
|
|
1779
|
-
var __defProp = Object.defineProperty;
|
|
1780
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1781
|
-
var __publicField = (obj, key, value) => {
|
|
1782
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1783
|
-
return value;
|
|
1784
|
-
};
|
|
1785
1749
|
const PATTERN_COLUMN = /^(int|float|locstring|string)(<[^:]+::[^>]+>)?\s([^\s]+)/;
|
|
1786
1750
|
const PATTERN_LAYOUT = /^LAYOUT\s(.*)/;
|
|
1787
1751
|
const PATTERN_FIELD = /^(\$([^$]+)\$)?([^<[]+)(<(u|)(\d+)>)?(\[(\d+)\])?$/;
|
|
@@ -1823,11 +1787,11 @@ const getCastBuffer = (value, srcSize, dstSize) => {
|
|
|
1823
1787
|
return castBuffer;
|
|
1824
1788
|
};
|
|
1825
1789
|
class DBDParser {
|
|
1790
|
+
wdc;
|
|
1791
|
+
definitions = /* @__PURE__ */ new Map();
|
|
1792
|
+
columns = [];
|
|
1793
|
+
cache = /* @__PURE__ */ new Map();
|
|
1826
1794
|
constructor(wdc) {
|
|
1827
|
-
__publicField(this, "wdc");
|
|
1828
|
-
__publicField(this, "definitions", /* @__PURE__ */ new Map());
|
|
1829
|
-
__publicField(this, "columns", []);
|
|
1830
|
-
__publicField(this, "cache", /* @__PURE__ */ new Map());
|
|
1831
1795
|
this.wdc = wdc;
|
|
1832
1796
|
}
|
|
1833
1797
|
async init() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhyster/wow-casc-dbc",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.19",
|
|
4
4
|
"description": "Fetch World of Warcraft data files from CASC and parse DBC/DB2 files.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"eslint": "^9.17.0",
|
|
45
45
|
"tsx": "^4.19.2",
|
|
46
46
|
"typescript": "^5.7.2",
|
|
47
|
-
"unbuild": "^
|
|
47
|
+
"unbuild": "^3.0.1"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"async": "^3.2.6",
|