@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.
Files changed (53) hide show
  1. package/README.md +59 -0
  2. package/lib/binary/bitreader.d.ts +22 -0
  3. package/lib/binary/bitreader.js +100 -0
  4. package/lib/binary/bitreader.js.map +1 -0
  5. package/lib/binary/bitwriter.d.ts +21 -0
  6. package/lib/binary/bitwriter.js +118 -0
  7. package/lib/binary/bitwriter.js.map +1 -0
  8. package/lib/binary/constants.d.ts +4 -0
  9. package/lib/binary/constants.js +9 -0
  10. package/lib/binary/constants.js.map +1 -0
  11. package/lib/d2/attribute_enhancer.d.ts +5 -0
  12. package/lib/d2/attribute_enhancer.js +593 -0
  13. package/lib/d2/attribute_enhancer.js.map +1 -0
  14. package/lib/d2/attributes.d.ts +4 -0
  15. package/lib/d2/attributes.js +99 -0
  16. package/lib/d2/attributes.js.map +1 -0
  17. package/lib/d2/constants.d.ts +4 -0
  18. package/lib/d2/constants.js +16 -0
  19. package/lib/d2/constants.js.map +1 -0
  20. package/lib/d2/d2s.d.ts +10 -0
  21. package/lib/d2/d2s.js +106 -0
  22. package/lib/d2/d2s.js.map +1 -0
  23. package/lib/d2/header.d.ts +8 -0
  24. package/lib/d2/header.js +95 -0
  25. package/lib/d2/header.js.map +1 -0
  26. package/lib/d2/items.d.ts +17 -0
  27. package/lib/d2/items.js +728 -0
  28. package/lib/d2/items.js.map +1 -0
  29. package/lib/d2/skills.d.ts +4 -0
  30. package/lib/d2/skills.js +45 -0
  31. package/lib/d2/skills.js.map +1 -0
  32. package/lib/d2/stash.d.ts +3 -0
  33. package/lib/d2/stash.js +196 -0
  34. package/lib/d2/stash.js.map +1 -0
  35. package/lib/d2/types.d.ts +402 -0
  36. package/lib/d2/types.js +15 -0
  37. package/lib/d2/types.js.map +1 -0
  38. package/lib/d2/versions/default_header.d.ts +5 -0
  39. package/lib/d2/versions/default_header.js +721 -0
  40. package/lib/d2/versions/default_header.js.map +1 -0
  41. package/lib/data/parser.d.ts +3 -0
  42. package/lib/data/parser.js +627 -0
  43. package/lib/data/parser.js.map +1 -0
  44. package/lib/data/versions/96_constant_data.d.ts +14427 -0
  45. package/lib/data/versions/96_constant_data.js +5 -0
  46. package/lib/data/versions/96_constant_data.js.map +1 -0
  47. package/lib/data/versions/99_constant_data.d.ts +15572 -0
  48. package/lib/data/versions/99_constant_data.js +5 -0
  49. package/lib/data/versions/99_constant_data.js.map +1 -0
  50. package/lib/index.d.ts +8 -0
  51. package/lib/index.js +47 -0
  52. package/lib/index.js.map +1 -0
  53. package/package.json +46 -0
@@ -0,0 +1,627 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.readConstantData = void 0;
23
+ const types = __importStar(require("../d2/types"));
24
+ //special stats. read the next N properties.
25
+ //seems to be hardcode in d2 and not in itemstatcost
26
+ const item_property_stat_count = {
27
+ item_maxdamage_percent: { numprops: 2, rangestr: "strModMinDamageRange", equalstr: "strModEnhancedDamage" },
28
+ firemindam: { numprops: 2, rangestr: "strModFireDamageRange", equalstr: "strModFireDamage" },
29
+ lightmindam: { numprops: 2, rangestr: "strModLightningDamageRange", equalstr: "strModLightningDamage" },
30
+ magicmindam: { numprops: 2, rangestr: "strModMagicDamageRange", equalstr: "strModMagicDamage" },
31
+ coldmindam: { numprops: 3, rangestr: "strModColdDamageRange", equalstr: "strModColdDamage" },
32
+ poisonmindam: { numprops: 3, rangestr: "strModPoisonDamageRange", equalstr: "strModPoisonDamage" },
33
+ };
34
+ //TODO use smaller field names to minimize size of file.
35
+ function readConstantData(buffers) {
36
+ const constants = {};
37
+ let strings = {};
38
+ if (_hasKey(buffers, "strings.txt")) {
39
+ strings = _readStrings(_getKey(buffers, "string.txt"));
40
+ strings = Object.assign(strings, _readStrings(_getKey(buffers, "expansionstring.txt")));
41
+ strings = Object.assign(strings, _readStrings(_getKey(buffers, "patchstring.txt")));
42
+ }
43
+ else {
44
+ strings = _readJSONStrings(_getKey(buffers, "item-gems.json"));
45
+ strings = Object.assign(strings, _readJSONStrings(_getKey(buffers, "item-modifiers.json")));
46
+ strings = Object.assign(strings, _readJSONStrings(_getKey(buffers, "item-nameaffixes.json")));
47
+ strings = Object.assign(strings, _readJSONStrings(_getKey(buffers, "item-names.json")));
48
+ strings = Object.assign(strings, _readJSONStrings(_getKey(buffers, "item-runes.json")));
49
+ strings = Object.assign(strings, _readJSONStrings(_getKey(buffers, "skills.json")));
50
+ }
51
+ constants.classes = _readClasses(_getArray(buffers, "CharStats.txt"), _getArray(buffers, "PlayerClass.txt"), strings);
52
+ const skillDescs = _readSkillDesc(_getArray(buffers, "SkillDesc.txt"), strings);
53
+ constants.skills = _readSkills(_getArray(buffers, "skills.txt"), skillDescs, strings);
54
+ constants.rare_names = [null].concat(_readRareNames(_getArray(buffers, "RareSuffix.txt"), 1, strings));
55
+ constants.rare_names = constants.rare_names.concat(_readRareNames(_getArray(buffers, "RarePrefix.txt"), constants.rare_names.length, strings));
56
+ constants.magic_prefixes = _readMagicNames(_getArray(buffers, "MagicPrefix.txt"), strings);
57
+ constants.magic_suffixes = _readMagicNames(_getArray(buffers, "MagicSuffix.txt"), strings);
58
+ constants.properties = _readProperties(_getArray(buffers, "Properties.txt"), strings);
59
+ constants.magical_properties = _readItemStatCosts(_getArray(buffers, "ItemStatCost.txt"), strings);
60
+ constants.runewords = _readRunewords(_getArray(buffers, "Runes.txt"), strings);
61
+ constants.set_items = _readSetOrUnqItems(_getArray(buffers, "SetItems.txt"), strings);
62
+ constants.unq_items = _readSetOrUnqItems(_getArray(buffers, "UniqueItems.txt"), strings);
63
+ const item_types = _readTypes(_getArray(buffers, "ItemTypes.txt"), strings);
64
+ const armor_items = _readItems(_getArray(buffers, "Armor.txt"), item_types, strings);
65
+ const weapon_items = _readItems(_getArray(buffers, "Weapons.txt"), item_types, strings);
66
+ const other_items = _readItems(_getArray(buffers, "Misc.txt"), item_types, strings);
67
+ constants.stackables = {};
68
+ [...armor_items, ...weapon_items, ...other_items]
69
+ .filter((item) => item.s === 1)
70
+ .map((item) => (constants.stackables[item.code] = { n: item.n }));
71
+ constants.armor_items = {};
72
+ armor_items.map((item) => {
73
+ constants.armor_items[item.code] = item;
74
+ delete item.code;
75
+ });
76
+ constants.weapon_items = {};
77
+ weapon_items.map((item) => {
78
+ constants.weapon_items[item.code] = item;
79
+ delete item.code;
80
+ });
81
+ constants.other_items = {};
82
+ other_items.map((item) => {
83
+ constants.other_items[item.code] = item;
84
+ delete item.code;
85
+ });
86
+ _readGems(constants.other_items, _getArray(buffers, "Gems.txt"), strings);
87
+ return constants;
88
+ }
89
+ exports.readConstantData = readConstantData;
90
+ function _getArray(files, find) {
91
+ return _readTsv(_getKey(files, find));
92
+ }
93
+ function _getKey(files, find) {
94
+ const key = Object.keys(files).find((key) => key.toLowerCase() === find.toLowerCase());
95
+ if (!key) {
96
+ throw new Error(`Cannot find file: ${find}`);
97
+ }
98
+ return files[key];
99
+ }
100
+ function _hasKey(files, find) {
101
+ return Object.keys(files).find((key) => key.toLowerCase() === find.toLowerCase()) != null;
102
+ }
103
+ function _readTsv(file) {
104
+ const lines = file.split(/\r?\n/).map((line) => line.split(/\t/));
105
+ const header = lines[0];
106
+ return {
107
+ header: header,
108
+ lines: lines,
109
+ };
110
+ }
111
+ function _readStrings(file) {
112
+ const result = {};
113
+ file
114
+ .split(/\r?\n/)
115
+ .map((line) => line.split(/\t/))
116
+ .map((line) => {
117
+ if (!result[line[0]]) {
118
+ result[line[0]] = line[1];
119
+ }
120
+ });
121
+ return result;
122
+ }
123
+ function _readJSONStrings(file) {
124
+ const result = {};
125
+ //remove BOM
126
+ if (file.charCodeAt(0) === 0xfeff) {
127
+ file = file.slice(1);
128
+ }
129
+ const data = JSON.parse(file);
130
+ for (const str of data) {
131
+ result[str.Key] = str.enUS;
132
+ }
133
+ return result;
134
+ }
135
+ function _readClasses(tsv, tsv2, strings) {
136
+ const arr = [];
137
+ const cClass = tsv.header.indexOf("class");
138
+ // str dex int vit tot stamina
139
+ const cStr = tsv.header.indexOf("str");
140
+ const cDex = tsv.header.indexOf("dex");
141
+ const cInt = tsv.header.indexOf("int");
142
+ const cVit = tsv.header.indexOf("vit");
143
+ const cStam = tsv.header.indexOf("stamina");
144
+ const cHpadd = tsv.header.indexOf("hpadd");
145
+ const cLifePerLvl = tsv.header.indexOf("LifePerLevel");
146
+ const cStamPerLvl = tsv.header.indexOf("StaminaPerLevel");
147
+ const cManaPerLvl = tsv.header.indexOf("ManaPerLevel");
148
+ const cLifePerVit = tsv.header.indexOf("LifePerVitality");
149
+ const cStamPerVit = tsv.header.indexOf("StaminaPerVitality");
150
+ const cManaPerMag = tsv.header.indexOf("ManaPerMagic");
151
+ const cAllSkills = tsv.header.indexOf("StrAllSkills");
152
+ const cSkillTab1 = tsv.header.indexOf("StrSkillTab1");
153
+ const cSkillTab2 = tsv.header.indexOf("StrSkillTab2");
154
+ const cSkillTab3 = tsv.header.indexOf("StrSkillTab3");
155
+ const cClassOnly = tsv.header.indexOf("StrClassOnly");
156
+ const cCode = tsv2.header.indexOf("Code");
157
+ let id = 0;
158
+ for (let i = 1; i < tsv.lines.length; i++) {
159
+ const clazz = tsv.lines[i][cClass];
160
+ if (clazz && clazz != "Expansion") {
161
+ arr[id] = {
162
+ n: clazz,
163
+ c: tsv2.lines[i][cCode],
164
+ as: strings[tsv.lines[i][cAllSkills]],
165
+ ts: [strings[tsv.lines[i][cSkillTab1]], strings[tsv.lines[i][cSkillTab2]], strings[tsv.lines[i][cSkillTab3]]],
166
+ co: strings[tsv.lines[i][cClassOnly]],
167
+ s: {
168
+ lpl: +tsv.lines[i][cLifePerLvl],
169
+ mpl: +tsv.lines[i][cManaPerLvl],
170
+ spl: +tsv.lines[i][cStamPerLvl],
171
+ lpv: +tsv.lines[i][cLifePerVit],
172
+ spv: +tsv.lines[i][cStamPerVit],
173
+ mpe: +tsv.lines[i][cManaPerMag],
174
+ },
175
+ a: {
176
+ str: +tsv.lines[i][cStr],
177
+ dex: +tsv.lines[i][cDex],
178
+ int: +tsv.lines[i][cInt],
179
+ vit: +tsv.lines[i][cVit],
180
+ stam: +tsv.lines[i][cStam],
181
+ hpadd: tsv.lines[i][cHpadd],
182
+ },
183
+ };
184
+ id++;
185
+ }
186
+ }
187
+ return arr;
188
+ }
189
+ function _readSkillDesc(tsv, strings) {
190
+ const arr = {};
191
+ const cSkillDesc = tsv.header.indexOf("skilldesc");
192
+ const cStrName = tsv.header.indexOf("str name");
193
+ for (let i = 1; i < tsv.lines.length; i++) {
194
+ const id = tsv.lines[i][cSkillDesc];
195
+ const skillStrName = tsv.lines[i][cStrName];
196
+ if (id && skillStrName) {
197
+ arr[id] = strings[skillStrName];
198
+ }
199
+ }
200
+ return arr;
201
+ }
202
+ function _readSkills(tsv, skillDescs, strings) {
203
+ const arr = [];
204
+ const cSkillDesc = tsv.header.indexOf("skilldesc");
205
+ let cId = tsv.header.indexOf("Id");
206
+ if (cId < 0) {
207
+ cId = tsv.header.indexOf("*Id");
208
+ }
209
+ const cCharclass = tsv.header.indexOf("charclass");
210
+ for (let i = 1; i < tsv.lines.length; i++) {
211
+ const id = +tsv.lines[i][cId];
212
+ const skillDesc = tsv.lines[i][cSkillDesc];
213
+ if (skillDesc) {
214
+ const o = {};
215
+ if (skillDescs[skillDesc])
216
+ o.s = skillDescs[skillDesc];
217
+ if (tsv.lines[i][cCharclass])
218
+ o.c = tsv.lines[i][cCharclass];
219
+ arr[id] = o;
220
+ }
221
+ }
222
+ return arr;
223
+ }
224
+ function _readRareNames(tsv, idx, strings) {
225
+ const arr = [];
226
+ const cName = tsv.header.indexOf("name");
227
+ let id = idx;
228
+ for (let i = 1; i < tsv.lines.length; i++) {
229
+ const name = tsv.lines[i][cName];
230
+ if (name) {
231
+ arr[id - idx] = {
232
+ n: strings[name],
233
+ };
234
+ id++;
235
+ }
236
+ }
237
+ return arr;
238
+ }
239
+ function _readMagicNames(tsv, strings) {
240
+ const arr = [];
241
+ const cName = tsv.header.indexOf("Name");
242
+ const cTransformcolor = tsv.header.indexOf("transformcolor");
243
+ let id = 1;
244
+ for (let i = 1; i < tsv.lines.length; i++) {
245
+ const name = tsv.lines[i][cName];
246
+ if (name != "Expansion") {
247
+ const o = {};
248
+ o.n = strings[name];
249
+ if (tsv.lines[i][cTransformcolor])
250
+ o.tc = tsv.lines[i][cTransformcolor];
251
+ arr[id] = o;
252
+ id++;
253
+ }
254
+ }
255
+ return arr;
256
+ }
257
+ function _readProperties(tsv, strings) {
258
+ const arr = {};
259
+ const cCode = tsv.header.indexOf("code");
260
+ const cStats = [];
261
+ for (let j = 1; j <= 7; j++) {
262
+ cStats[j] = {};
263
+ cStats[j].cStat = tsv.header.indexOf(`stat${j}`);
264
+ cStats[j].cFunc = tsv.header.indexOf(`func${j}`);
265
+ }
266
+ for (let i = 1; i < tsv.lines.length; i++) {
267
+ const code = tsv.lines[i][cCode];
268
+ if (code != "Expansion") {
269
+ const prop = [];
270
+ //prop.code = code;
271
+ for (let j = 1; j <= 7; j++) {
272
+ const stat = tsv.lines[i][cStats[j].cStat];
273
+ const func = tsv.lines[i][cStats[j].cFunc];
274
+ if (!stat && !func) {
275
+ break;
276
+ }
277
+ const s = {};
278
+ if (stat)
279
+ s.s = stat;
280
+ if (func)
281
+ s.f = +func;
282
+ prop[j - 1] = s;
283
+ }
284
+ if (prop.length) {
285
+ arr[code] = prop;
286
+ }
287
+ }
288
+ }
289
+ return arr;
290
+ }
291
+ function _readRunewords(tsv, strings) {
292
+ const arr = [];
293
+ const cName = tsv.header.indexOf("Name");
294
+ for (let i = 1; i < tsv.lines.length; i++) {
295
+ const name = tsv.lines[i][cName];
296
+ if (name) {
297
+ let id = +name.substring(8);
298
+ //TODO: why?
299
+ if (id > 75) {
300
+ id += 25;
301
+ }
302
+ else {
303
+ id += 26;
304
+ }
305
+ arr[id] = {
306
+ n: strings[tsv.lines[i][cName]],
307
+ };
308
+ }
309
+ }
310
+ return arr;
311
+ }
312
+ function _readTypes(tsv, strings) {
313
+ const arr = {};
314
+ const cCode = tsv.header.indexOf("Code");
315
+ const cItemType = tsv.header.indexOf("ItemType");
316
+ const cEquiv1 = tsv.header.indexOf("Equiv1");
317
+ const cEquiv2 = tsv.header.indexOf("Equiv2");
318
+ const cInvGfx = [];
319
+ for (let i = 1; i <= 6; i++) {
320
+ cInvGfx.push(tsv.header.indexOf(`InvGfx${i}`));
321
+ }
322
+ for (let i = 1; i < tsv.lines.length; i++) {
323
+ const code = tsv.lines[i][cCode];
324
+ if (code) {
325
+ const o = {};
326
+ const invgfx = [];
327
+ for (let j = 0; j <= 6; j++) {
328
+ if (tsv.lines[i][cInvGfx[j]])
329
+ invgfx[j] = tsv.lines[i][cInvGfx[j]];
330
+ }
331
+ o.ig = invgfx;
332
+ o.eq1 = tsv.lines[i][cEquiv1];
333
+ o.eq2 = tsv.lines[i][cEquiv2];
334
+ o.n = tsv.lines[i][cItemType];
335
+ o.c = [o.n];
336
+ arr[code] = o;
337
+ }
338
+ }
339
+ for (const k of Object.keys(arr)) {
340
+ arr[k].c = [..._resolvetItemTypeCategories(arr, k)];
341
+ if (arr[k] !== undefined && arr[arr[k].eq1] !== undefined) {
342
+ arr[k].eq1n = arr[arr[k].eq1].n;
343
+ }
344
+ if (arr[k] !== undefined && arr[arr[k].eq2] !== undefined) {
345
+ arr[k].eq2n = arr[arr[k].eq2].n;
346
+ }
347
+ }
348
+ return arr;
349
+ }
350
+ function _resolvetItemTypeCategories(arr, key) {
351
+ let res = [];
352
+ if (arr[key] !== undefined) {
353
+ res = [arr[key].n, ..._resolvetItemTypeCategories(arr, arr[key].eq1), ..._resolvetItemTypeCategories(arr, arr[key].eq2)];
354
+ }
355
+ return res;
356
+ }
357
+ function _readItems(tsv, itemtypes, strings) {
358
+ const arr = [];
359
+ const cCode = tsv.header.indexOf("code");
360
+ const cNameStr = tsv.header.indexOf("namestr");
361
+ const cStackable = tsv.header.indexOf("stackable");
362
+ const cMinac = tsv.header.indexOf("minac");
363
+ const cMaxac = tsv.header.indexOf("maxac");
364
+ const cDurability = tsv.header.indexOf("durability");
365
+ const cMindam = tsv.header.indexOf("mindam");
366
+ const cMaxdam = tsv.header.indexOf("maxdam");
367
+ const cTwoHandMindam = tsv.header.indexOf("2handmindam");
368
+ const cTwoHandMaxdam = tsv.header.indexOf("2handmaxdam");
369
+ const cMinmisdam = tsv.header.indexOf("minmisdam");
370
+ const cMaxmisdam = tsv.header.indexOf("maxmisdam");
371
+ const cReqstr = tsv.header.indexOf("reqstr");
372
+ const cReqdex = tsv.header.indexOf("reqdex");
373
+ const cHasinv = tsv.header.indexOf("hasinv");
374
+ const cGemapplytype = tsv.header.indexOf("gemapplytype");
375
+ const cInvfile = tsv.header.indexOf("invfile");
376
+ const cUniqueInvfile = tsv.header.indexOf("uniqueinvfile");
377
+ const cSetInvfile = tsv.header.indexOf("setinvfile");
378
+ const cInvwidth = tsv.header.indexOf("invwidth");
379
+ const cInvheight = tsv.header.indexOf("invheight");
380
+ const cInvtransform = tsv.header.indexOf("InvTrans");
381
+ const cType = tsv.header.indexOf("type");
382
+ const cNormCode = tsv.header.indexOf("normcode");
383
+ const cUberCode = tsv.header.indexOf("ubercode");
384
+ const cUltraCode = tsv.header.indexOf("ultracode");
385
+ for (let i = 1; i < tsv.lines.length; i++) {
386
+ const code = tsv.lines[i][cCode];
387
+ if (code) {
388
+ const item = {};
389
+ item.code = code;
390
+ item.nc = tsv.lines[i][cNormCode];
391
+ item.exc = tsv.lines[i][cUberCode];
392
+ item.elc = tsv.lines[i][cUltraCode];
393
+ item.iq =
394
+ item.code === item.exc
395
+ ? types.EItemQuality.exceptional
396
+ : item.code === item.elc
397
+ ? types.EItemQuality.elite
398
+ : types.EItemQuality.normal;
399
+ item.n = strings[tsv.lines[i][cNameStr]];
400
+ if (tsv.lines[i][cStackable] && +tsv.lines[i][cStackable] > 0)
401
+ item.s = 1;
402
+ if (tsv.lines[i][cMinac] && +tsv.lines[i][cMinac] > 0)
403
+ item.minac = +tsv.lines[i][cMinac];
404
+ if (tsv.lines[i][cMaxac] && +tsv.lines[i][cMaxac] > 0)
405
+ item.maxac = +tsv.lines[i][cMaxac];
406
+ if (tsv.lines[i][cDurability])
407
+ item.durability = +tsv.lines[i][cDurability];
408
+ if (tsv.lines[i][cMindam] && +tsv.lines[i][cMindam] > 0)
409
+ item.mind = +tsv.lines[i][cMindam];
410
+ if (tsv.lines[i][cMaxdam] && +tsv.lines[i][cMaxdam] > 0)
411
+ item.maxd = +tsv.lines[i][cMaxdam];
412
+ if (tsv.lines[i][cTwoHandMindam] && +tsv.lines[i][cTwoHandMindam] > 0)
413
+ item.min2d = +tsv.lines[i][cTwoHandMindam];
414
+ if (tsv.lines[i][cTwoHandMaxdam] && +tsv.lines[i][cTwoHandMaxdam] > 0)
415
+ item.max2d = +tsv.lines[i][cTwoHandMaxdam];
416
+ if (tsv.lines[i][cMinmisdam] && +tsv.lines[i][cMinmisdam] > 0)
417
+ item.minmd = +tsv.lines[i][cMinmisdam];
418
+ if (tsv.lines[i][cMaxmisdam] && +tsv.lines[i][cMaxmisdam] > 0)
419
+ item.maxmd = +tsv.lines[i][cMaxmisdam];
420
+ if (tsv.lines[i][cReqstr])
421
+ item.rs = +tsv.lines[i][cReqstr];
422
+ if (tsv.lines[i][cReqdex])
423
+ item.rd = +tsv.lines[i][cReqdex];
424
+ if (tsv.lines[i][cHasinv])
425
+ item.hi = +tsv.lines[i][cHasinv];
426
+ if (tsv.lines[i][cGemapplytype])
427
+ item.gt = +tsv.lines[i][cGemapplytype];
428
+ if (tsv.lines[i][cInvfile])
429
+ item.i = tsv.lines[i][cInvfile];
430
+ if (tsv.lines[i][cUniqueInvfile])
431
+ item.ui = tsv.lines[i][cUniqueInvfile];
432
+ if (tsv.lines[i][cSetInvfile])
433
+ item.si = tsv.lines[i][cSetInvfile];
434
+ if (tsv.lines[i][cInvwidth])
435
+ item.iw = +tsv.lines[i][cInvwidth];
436
+ if (tsv.lines[i][cInvheight])
437
+ item.ih = +tsv.lines[i][cInvheight];
438
+ if (tsv.lines[i][cInvtransform])
439
+ item.it = +tsv.lines[i][cInvtransform];
440
+ const type = itemtypes[tsv.lines[i][cType]];
441
+ if (type && type.ig) {
442
+ item.ig = type.ig;
443
+ item.eq1n = type.eq1n;
444
+ item.eq2n = type.eq2n;
445
+ item.c = type.c;
446
+ }
447
+ arr.push(item);
448
+ }
449
+ }
450
+ return arr;
451
+ }
452
+ function _readGems(miscItems, tsv, strings) {
453
+ const cCode = tsv.header.indexOf("code");
454
+ const types = ["weapon", "helm", "shield"];
455
+ const cols = {};
456
+ for (const type of types) {
457
+ cols[type] = [];
458
+ for (let j = 1; j <= 3; j++) {
459
+ cols[type][j] = {};
460
+ cols[type][j].cMod = tsv.header.indexOf(`${type}Mod${j}Code`);
461
+ cols[type][j].cParam = tsv.header.indexOf(`${type}Mod${j}Param`);
462
+ cols[type][j].cMin = tsv.header.indexOf(`${type}Mod${j}Min`);
463
+ cols[type][j].cMax = tsv.header.indexOf(`${type}Mod${j}Max`);
464
+ }
465
+ }
466
+ for (let i = 1; i < tsv.lines.length; i++) {
467
+ const code = tsv.lines[i][cCode];
468
+ if (code && code != "Expansion") {
469
+ const item = miscItems[code];
470
+ for (let k = 0; k < 3; k++) {
471
+ const type = types[k];
472
+ for (let j = 1; j <= 3; j++) {
473
+ const mod = tsv.lines[i][cols[type][j].cMod];
474
+ if (!mod) {
475
+ break;
476
+ }
477
+ if (j == 1) {
478
+ if (!item.m)
479
+ item.m = [];
480
+ item.m[k] = [];
481
+ }
482
+ const m = {};
483
+ m.m = mod;
484
+ if (tsv.lines[i][cols[type][j].cParam])
485
+ m.p = +tsv.lines[i][cols[type][j].cParam];
486
+ if (tsv.lines[i][cols[type][j].cMin])
487
+ m.min = +tsv.lines[i][cols[type][j].cMin];
488
+ if (tsv.lines[i][cols[type][j].cMax])
489
+ m.max = +tsv.lines[i][cols[type][j].cMax];
490
+ item.m[k].push(m);
491
+ }
492
+ }
493
+ }
494
+ }
495
+ }
496
+ function _readSetOrUnqItems(tsv, strings) {
497
+ const arr = [];
498
+ const cIndex = tsv.header.indexOf("index");
499
+ const cInvfile = tsv.header.indexOf("invfile");
500
+ let cCode = tsv.header.indexOf("code");
501
+ if (cCode < 0)
502
+ cCode = tsv.header.indexOf("item");
503
+ const cInvtransform = tsv.header.indexOf("invtransform");
504
+ let id = 0;
505
+ for (let i = 1; i < tsv.lines.length; i++) {
506
+ const index = tsv.lines[i][cIndex];
507
+ if (index && index != "Expansion") {
508
+ const o = {};
509
+ o.n = strings[tsv.lines[i][cIndex]];
510
+ if (tsv.lines[i][cInvfile])
511
+ o.i = tsv.lines[i][cInvfile];
512
+ if (tsv.lines[i][cCode])
513
+ o.c = tsv.lines[i][cCode];
514
+ if (tsv.lines[i][cInvtransform])
515
+ o.tc = tsv.lines[i][cInvtransform];
516
+ arr[id] = o;
517
+ id++;
518
+ }
519
+ }
520
+ return arr;
521
+ }
522
+ function _readItemStatCosts(tsv, strings) {
523
+ const arr = [];
524
+ const cStat = tsv.header.indexOf("Stat");
525
+ let cId = tsv.header.indexOf("ID");
526
+ if (cId < 0) {
527
+ cId = tsv.header.indexOf("*ID");
528
+ }
529
+ const cCSvBits = tsv.header.indexOf("CSvBits");
530
+ const cCSvParam = tsv.header.indexOf("CSvParam");
531
+ const cCSvSigned = tsv.header.indexOf("CSvSigned");
532
+ const cEncode = tsv.header.indexOf("Encode");
533
+ const cValShift = tsv.header.indexOf("ValShift");
534
+ const cSigned = tsv.header.indexOf("Signed");
535
+ const cSaveBits = tsv.header.indexOf("Save Bits");
536
+ const cSaveAdd = tsv.header.indexOf("Save Add");
537
+ const cSaveParamBits = tsv.header.indexOf("Save Param Bits");
538
+ const cDescPriority = tsv.header.indexOf("descpriority");
539
+ const cDescFunc = tsv.header.indexOf("descfunc");
540
+ const cDescVal = tsv.header.indexOf("descval");
541
+ const cDescstrpos = tsv.header.indexOf("descstrpos");
542
+ const cDescstrneg = tsv.header.indexOf("descstrneg");
543
+ const cDescstr2 = tsv.header.indexOf("descstr2");
544
+ const cDgrp = tsv.header.indexOf("dgrp");
545
+ const cDgrpFunc = tsv.header.indexOf("dgrpfunc");
546
+ const cDgrpVal = tsv.header.indexOf("dgrpval");
547
+ const cDgrpstrpos = tsv.header.indexOf("dgrpstrpos");
548
+ const cDgrpstrneg = tsv.header.indexOf("dgrpstrneg");
549
+ const cDgrpstr2 = tsv.header.indexOf("dgrpstr2");
550
+ const cOp = tsv.header.indexOf("op");
551
+ const cOpParam = tsv.header.indexOf("op param");
552
+ const cOpBase = tsv.header.indexOf("op base");
553
+ const cOpStat1 = tsv.header.indexOf("op stat1");
554
+ const cOpStat2 = tsv.header.indexOf("op stat2");
555
+ const cOpStat3 = tsv.header.indexOf("op stat3");
556
+ for (let i = 1; i < tsv.lines.length; i++) {
557
+ const id = +tsv.lines[i][cId];
558
+ const stat = tsv.lines[i][cStat];
559
+ if (stat) {
560
+ const o = {};
561
+ o.s = stat;
562
+ if (tsv.lines[i][cCSvBits])
563
+ o.cB = +tsv.lines[i][cCSvBits];
564
+ if (tsv.lines[i][cCSvParam])
565
+ o.cP = +tsv.lines[i][cCSvParam];
566
+ if (tsv.lines[i][cCSvSigned])
567
+ o.cS = +tsv.lines[i][cCSvSigned];
568
+ if (tsv.lines[i][cEncode])
569
+ o.e = +tsv.lines[i][cEncode];
570
+ if (tsv.lines[i][cValShift])
571
+ o.vS = +tsv.lines[i][cValShift];
572
+ if (tsv.lines[i][cSigned])
573
+ o.sS = +tsv.lines[i][cSigned];
574
+ if (tsv.lines[i][cSaveBits])
575
+ o.sB = +tsv.lines[i][cSaveBits];
576
+ if (tsv.lines[i][cSaveAdd])
577
+ o.sA = +tsv.lines[i][cSaveAdd];
578
+ if (tsv.lines[i][cSaveParamBits])
579
+ o.sP = +tsv.lines[i][cSaveParamBits];
580
+ if (tsv.lines[i][cDescPriority])
581
+ o.so = +tsv.lines[i][cDescPriority];
582
+ if (tsv.lines[i][cDescFunc])
583
+ o.dF = +tsv.lines[i][cDescFunc];
584
+ if (tsv.lines[i][cDescVal])
585
+ o.dV = +tsv.lines[i][cDescVal];
586
+ if (tsv.lines[i][cDescstrpos])
587
+ o.dP = strings[tsv.lines[i][cDescstrpos]];
588
+ if (tsv.lines[i][cDescstrneg])
589
+ o.dN = strings[tsv.lines[i][cDescstrneg]];
590
+ if (tsv.lines[i][cDescstr2])
591
+ o.d2 = strings[tsv.lines[i][cDescstr2]];
592
+ if (tsv.lines[i][cDgrp])
593
+ o.dg = +tsv.lines[i][cDgrp];
594
+ if (tsv.lines[i][cDgrpFunc])
595
+ o.dgF = +tsv.lines[i][cDgrpFunc];
596
+ if (tsv.lines[i][cDgrpVal])
597
+ o.dgV = +tsv.lines[i][cDgrpVal];
598
+ if (tsv.lines[i][cDgrpstrpos])
599
+ o.dgP = strings[tsv.lines[i][cDgrpstrpos]];
600
+ if (tsv.lines[i][cDgrpstrneg])
601
+ o.dN = strings[tsv.lines[i][cDgrpstrneg]];
602
+ if (tsv.lines[i][cDgrpstr2])
603
+ o.dg2 = strings[tsv.lines[i][cDgrpstr2]];
604
+ if (tsv.lines[i][cOp])
605
+ o.o = +tsv.lines[i][cOp];
606
+ if (tsv.lines[i][cOpParam])
607
+ o.op = +tsv.lines[i][cOpParam];
608
+ if (tsv.lines[i][cOpBase])
609
+ o.ob = tsv.lines[i][cOpBase];
610
+ if (tsv.lines[i][cOpStat1])
611
+ o.os = [tsv.lines[i][cOpStat1]];
612
+ if (tsv.lines[i][cOpStat2])
613
+ o.os[1] = tsv.lines[i][cOpStat2];
614
+ if (tsv.lines[i][cOpStat3])
615
+ o.os[2] = tsv.lines[i][cOpStat3];
616
+ const dmgstatrange = item_property_stat_count[stat];
617
+ if (dmgstatrange) {
618
+ o.np = dmgstatrange.numprops;
619
+ o.dR = strings[dmgstatrange.rangestr];
620
+ o.dE = strings[dmgstatrange.equalstr];
621
+ }
622
+ arr[id] = o;
623
+ }
624
+ }
625
+ return arr;
626
+ }
627
+ //# sourceMappingURL=parser.js.map