d2r-saver 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +126 -0
- package/data/data.json +1 -0
- package/data/strings.json +1 -0
- package/dist/core/binary-reader.d.ts +43 -0
- package/dist/core/binary-reader.d.ts.map +1 -0
- package/dist/core/binary-reader.js +130 -0
- package/dist/core/binary-reader.js.map +1 -0
- package/dist/core/binary-writer.d.ts +49 -0
- package/dist/core/binary-writer.d.ts.map +1 -0
- package/dist/core/binary-writer.js +156 -0
- package/dist/core/binary-writer.js.map +1 -0
- package/dist/core/checksum.d.ts +28 -0
- package/dist/core/checksum.d.ts.map +1 -0
- package/dist/core/checksum.js +62 -0
- package/dist/core/checksum.js.map +1 -0
- package/dist/core/huffman.d.ts +22 -0
- package/dist/core/huffman.d.ts.map +1 -0
- package/dist/core/huffman.js +66 -0
- package/dist/core/huffman.js.map +1 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +5 -0
- package/dist/core/index.js.map +1 -0
- package/dist/formats/d2i-reader.d.ts +53 -0
- package/dist/formats/d2i-reader.d.ts.map +1 -0
- package/dist/formats/d2i-reader.js +208 -0
- package/dist/formats/d2i-reader.js.map +1 -0
- package/dist/formats/d2i-writer.d.ts +63 -0
- package/dist/formats/d2i-writer.d.ts.map +1 -0
- package/dist/formats/d2i-writer.js +229 -0
- package/dist/formats/d2i-writer.js.map +1 -0
- package/dist/formats/d2s-reader.d.ts +104 -0
- package/dist/formats/d2s-reader.d.ts.map +1 -0
- package/dist/formats/d2s-reader.js +257 -0
- package/dist/formats/d2s-reader.js.map +1 -0
- package/dist/formats/d2s-writer.d.ts +52 -0
- package/dist/formats/d2s-writer.d.ts.map +1 -0
- package/dist/formats/d2s-writer.js +407 -0
- package/dist/formats/d2s-writer.js.map +1 -0
- package/dist/formats/detect.d.ts +18 -0
- package/dist/formats/detect.d.ts.map +1 -0
- package/dist/formats/detect.js +40 -0
- package/dist/formats/detect.js.map +1 -0
- package/dist/formats/index.d.ts +8 -0
- package/dist/formats/index.d.ts.map +1 -0
- package/dist/formats/index.js +8 -0
- package/dist/formats/index.js.map +1 -0
- package/dist/formats/item-parser.d.ts +97 -0
- package/dist/formats/item-parser.d.ts.map +1 -0
- package/dist/formats/item-parser.js +627 -0
- package/dist/formats/item-parser.js.map +1 -0
- package/dist/formats/item-writer.d.ts +55 -0
- package/dist/formats/item-writer.d.ts.map +1 -0
- package/dist/formats/item-writer.js +514 -0
- package/dist/formats/item-writer.js.map +1 -0
- package/dist/game-data/game-data.d.ts +90 -0
- package/dist/game-data/game-data.d.ts.map +1 -0
- package/dist/game-data/game-data.js +355 -0
- package/dist/game-data/game-data.js.map +1 -0
- package/dist/game-data/index.d.ts +4 -0
- package/dist/game-data/index.d.ts.map +1 -0
- package/dist/game-data/index.js +3 -0
- package/dist/game-data/index.js.map +1 -0
- package/dist/game-data/loader.d.ts +23 -0
- package/dist/game-data/loader.d.ts.map +1 -0
- package/dist/game-data/loader.js +32 -0
- package/dist/game-data/loader.js.map +1 -0
- package/dist/game-data/types.d.ts +428 -0
- package/dist/game-data/types.d.ts.map +1 -0
- package/dist/game-data/types.js +10 -0
- package/dist/game-data/types.js.map +1 -0
- package/dist/index.d.ts +166 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +197 -0
- package/dist/index.js.map +1 -0
- package/dist/inventory/dimensions.d.ts +42 -0
- package/dist/inventory/dimensions.d.ts.map +1 -0
- package/dist/inventory/dimensions.js +30 -0
- package/dist/inventory/dimensions.js.map +1 -0
- package/dist/inventory/grid.d.ts +53 -0
- package/dist/inventory/grid.d.ts.map +1 -0
- package/dist/inventory/grid.js +117 -0
- package/dist/inventory/grid.js.map +1 -0
- package/dist/inventory/index.d.ts +4 -0
- package/dist/inventory/index.d.ts.map +1 -0
- package/dist/inventory/index.js +4 -0
- package/dist/inventory/index.js.map +1 -0
- package/dist/inventory/placement.d.ts +68 -0
- package/dist/inventory/placement.d.ts.map +1 -0
- package/dist/inventory/placement.js +90 -0
- package/dist/inventory/placement.js.map +1 -0
- package/dist/items/index.d.ts +7 -0
- package/dist/items/index.d.ts.map +1 -0
- package/dist/items/index.js +7 -0
- package/dist/items/index.js.map +1 -0
- package/dist/items/item-dto.d.ts +47 -0
- package/dist/items/item-dto.d.ts.map +1 -0
- package/dist/items/item-dto.js +124 -0
- package/dist/items/item-dto.js.map +1 -0
- package/dist/items/item-icon.d.ts +27 -0
- package/dist/items/item-icon.d.ts.map +1 -0
- package/dist/items/item-icon.js +103 -0
- package/dist/items/item-icon.js.map +1 -0
- package/dist/items/item-serializer.d.ts +38 -0
- package/dist/items/item-serializer.d.ts.map +1 -0
- package/dist/items/item-serializer.js +92 -0
- package/dist/items/item-serializer.js.map +1 -0
- package/dist/items/item-stats-parser.d.ts +52 -0
- package/dist/items/item-stats-parser.d.ts.map +1 -0
- package/dist/items/item-stats-parser.js +671 -0
- package/dist/items/item-stats-parser.js.map +1 -0
- package/dist/items/item-types.d.ts +40 -0
- package/dist/items/item-types.d.ts.map +1 -0
- package/dist/items/item-types.js +198 -0
- package/dist/items/item-types.js.map +1 -0
- package/dist/items/item.d.ts +61 -0
- package/dist/items/item.d.ts.map +1 -0
- package/dist/items/item.js +335 -0
- package/dist/items/item.js.map +1 -0
- package/dist/operations/extract-item.d.ts +39 -0
- package/dist/operations/extract-item.d.ts.map +1 -0
- package/dist/operations/extract-item.js +204 -0
- package/dist/operations/extract-item.js.map +1 -0
- package/dist/operations/index.d.ts +4 -0
- package/dist/operations/index.d.ts.map +1 -0
- package/dist/operations/index.js +4 -0
- package/dist/operations/index.js.map +1 -0
- package/dist/operations/insert-item.d.ts +59 -0
- package/dist/operations/insert-item.d.ts.map +1 -0
- package/dist/operations/insert-item.js +210 -0
- package/dist/operations/insert-item.js.map +1 -0
- package/dist/operations/read-save.d.ts +25 -0
- package/dist/operations/read-save.d.ts.map +1 -0
- package/dist/operations/read-save.js +27 -0
- package/dist/operations/read-save.js.map +1 -0
- package/dist/types/constants.d.ts +76 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/constants.js +96 -0
- package/dist/types/constants.js.map +1 -0
- package/dist/types/errors.d.ts +47 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +53 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/item.d.ts +112 -0
- package/dist/types/item.d.ts.map +1 -0
- package/dist/types/item.js +6 -0
- package/dist/types/item.js.map +1 -0
- package/dist/types/save-file.d.ts +74 -0
- package/dist/types/save-file.d.ts.map +1 -0
- package/dist/types/save-file.js +5 -0
- package/dist/types/save-file.js.map +1 -0
- package/dist/types/trade-item.d.ts +37 -0
- package/dist/types/trade-item.d.ts.map +1 -0
- package/dist/types/trade-item.js +5 -0
- package/dist/types/trade-item.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,cAAc,EACd,WAAW,EACX,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,YAAY,GACb,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,UAAU,EACV,WAAW,GACZ,MAAM,WAAW,CAAC;AAGnB,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,cAAc,EACd,cAAc,EACd,SAAS,EACT,YAAY,EACZ,cAAc,GACf,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// ─── Constants & Enums ──────────────────────────────────────────
|
|
2
|
+
export { ItemQuality, LocationType, StorageType, BodyLocation, CharacterClass, CLASS_NAMES, D2S_MAGIC, D2I_MAGIC, BLIZZLESS_VERSION, STASH_WIDTH, STASH_HEIGHT, INVENTORY_WIDTH, INVENTORY_HEIGHT, CUBE_WIDTH, CUBE_HEIGHT, SECTION_ITEMS, SECTION_STATS, SECTION_EXTENDED, TOKEN_PREFIX, } from './constants.js';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,OAAO,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,cAAc,EACd,WAAW,EACX,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,YAAY,GACb,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for parsed items — the internal representation of a D2R item
|
|
3
|
+
* after reading from a save file.
|
|
4
|
+
*/
|
|
5
|
+
import type { ItemQuality, LocationType, StorageType, BodyLocation } from './constants.js';
|
|
6
|
+
/**
|
|
7
|
+
* Mod values: stat ID → array of parameter values.
|
|
8
|
+
* `values[0..4]` correspond to `mod1max..mod5max` in the data tables.
|
|
9
|
+
*/
|
|
10
|
+
export type ModContainer = Record<string, number[]>;
|
|
11
|
+
/** Raw location fields as stored in the binary save data. */
|
|
12
|
+
export interface RawItemLocation {
|
|
13
|
+
/** 3-bit location type. */
|
|
14
|
+
location: LocationType;
|
|
15
|
+
/** 4-bit body slot (for equipped items). */
|
|
16
|
+
bodyloc: BodyLocation;
|
|
17
|
+
/** 3-bit storage identifier (for stored items). */
|
|
18
|
+
storage: StorageType;
|
|
19
|
+
/** Column in the storage grid. */
|
|
20
|
+
x: number;
|
|
21
|
+
/** Row in the storage grid. */
|
|
22
|
+
y: number;
|
|
23
|
+
}
|
|
24
|
+
/** Resolved item location with source context. */
|
|
25
|
+
export interface ItemLocation {
|
|
26
|
+
/** Source file type. */
|
|
27
|
+
source: 'character' | 'sharedStash';
|
|
28
|
+
/** Original filename (for debugging / display). */
|
|
29
|
+
sourceFile: string;
|
|
30
|
+
/** Storage type the item resides in. */
|
|
31
|
+
storage: StorageType;
|
|
32
|
+
/** For d2i — zero-based page index. */
|
|
33
|
+
page?: number;
|
|
34
|
+
/** Column in the storage grid. */
|
|
35
|
+
x: number;
|
|
36
|
+
/** Row in the storage grid. */
|
|
37
|
+
y: number;
|
|
38
|
+
/** Raw binary location fields. */
|
|
39
|
+
raw: RawItemLocation;
|
|
40
|
+
}
|
|
41
|
+
export interface EarData {
|
|
42
|
+
class: number;
|
|
43
|
+
level: number;
|
|
44
|
+
name: string;
|
|
45
|
+
}
|
|
46
|
+
/** Bit offset range of an item in the original save file. */
|
|
47
|
+
export interface BinaryOffset {
|
|
48
|
+
/** Bit offset where the item data starts. */
|
|
49
|
+
start: number;
|
|
50
|
+
/** Bit offset where the item data ends. */
|
|
51
|
+
end: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Internal representation of a parsed D2R item.
|
|
55
|
+
* Produced by the item parser, consumed by item writer and trade DTO converter.
|
|
56
|
+
*/
|
|
57
|
+
export interface ParsedItem {
|
|
58
|
+
/** 3-character item code (e.g. "rin", "cap", "r01"). */
|
|
59
|
+
base: string;
|
|
60
|
+
/** Item quality. */
|
|
61
|
+
quality: ItemQuality;
|
|
62
|
+
/** Item level (7 bits in save). */
|
|
63
|
+
ilvl: number;
|
|
64
|
+
/** Whether the item is unidentified. */
|
|
65
|
+
unidentified: boolean;
|
|
66
|
+
/** Whether the item is ethereal. */
|
|
67
|
+
ethereal: boolean;
|
|
68
|
+
/** Number of sockets. */
|
|
69
|
+
sockets: number;
|
|
70
|
+
/** Socketed child items (gems, runes, jewels). */
|
|
71
|
+
socketedItems: ParsedItem[];
|
|
72
|
+
/** Computed stats from all sources (for display/search). */
|
|
73
|
+
stats: Record<string, number>;
|
|
74
|
+
/** ID in unique/set/runeword table (e.g. "unique001"). */
|
|
75
|
+
unique?: string;
|
|
76
|
+
/** Generated name for rare/crafted items. */
|
|
77
|
+
name?: string;
|
|
78
|
+
/** Variable range values for unique/set/runeword properties. */
|
|
79
|
+
uniqueValues?: number[];
|
|
80
|
+
/** Magic prefix/suffix mods. */
|
|
81
|
+
mods?: ModContainer;
|
|
82
|
+
/** Auto-prefix mods. */
|
|
83
|
+
auto?: ModContainer;
|
|
84
|
+
/** Staff (class-specific) mods. */
|
|
85
|
+
staff?: ModContainer;
|
|
86
|
+
/** Crafted recipe mods. */
|
|
87
|
+
crafted?: ModContainer;
|
|
88
|
+
/** Superior quality mods. */
|
|
89
|
+
superior?: ModContainer;
|
|
90
|
+
/** Base defense (armor items). */
|
|
91
|
+
defense?: number;
|
|
92
|
+
/** Stack quantity (stackable items, potions, etc.). */
|
|
93
|
+
quantity?: number;
|
|
94
|
+
/** Ear item data. */
|
|
95
|
+
ear?: EarData;
|
|
96
|
+
/** Personalized inscription name. */
|
|
97
|
+
personalized?: string;
|
|
98
|
+
/** Alternate graphics index (3 bits). */
|
|
99
|
+
iconIndex?: number;
|
|
100
|
+
/** Whether this item was "custom" parsed (stats didn't match known definitions). */
|
|
101
|
+
custom?: boolean;
|
|
102
|
+
/** Internal 32-bit item ID from the save file. */
|
|
103
|
+
itemId: number;
|
|
104
|
+
/** Bit offsets in the original binary buffer. */
|
|
105
|
+
binaryOffset: BinaryOffset;
|
|
106
|
+
}
|
|
107
|
+
/** A parsed item together with its location in the save file. */
|
|
108
|
+
export interface LocatedItem {
|
|
109
|
+
item: ParsedItem;
|
|
110
|
+
location: ItemLocation;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../src/types/item.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI3F;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAIpD,6DAA6D;AAC7D,MAAM,WAAW,eAAe;IAC9B,2BAA2B;IAC3B,QAAQ,EAAE,YAAY,CAAC;IACvB,4CAA4C;IAC5C,OAAO,EAAE,YAAY,CAAC;IACtB,mDAAmD;IACnD,OAAO,EAAE,WAAW,CAAC;IACrB,kCAAkC;IAClC,CAAC,EAAE,MAAM,CAAC;IACV,+BAA+B;IAC/B,CAAC,EAAE,MAAM,CAAC;CACX;AAED,kDAAkD;AAClD,MAAM,WAAW,YAAY;IAC3B,wBAAwB;IACxB,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;IACpC,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,OAAO,EAAE,WAAW,CAAC;IACrB,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,CAAC,EAAE,MAAM,CAAC;IACV,+BAA+B;IAC/B,CAAC,EAAE,MAAM,CAAC;IACV,kCAAkC;IAClC,GAAG,EAAE,eAAe,CAAC;CACtB;AAID,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAID,6DAA6D;AAC7D,MAAM,WAAW,YAAY;IA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AAM,CAAC,EAAE,OAAO,CAAC;IAIjB,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IAEf,iDAAiD;IACjD,YAAY,EAAE,YAAY,CAAC;CAC5B;AAID,iEAAiE;AACjE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item.js","sourceRoot":"","sources":["../../src/types/item.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for D2S (character) and D2I (shared stash) file structures.
|
|
3
|
+
*/
|
|
4
|
+
import type { LocatedItem } from './item.js';
|
|
5
|
+
import type { CharacterClass } from './constants.js';
|
|
6
|
+
export interface CharacterStats {
|
|
7
|
+
str: number;
|
|
8
|
+
dex: number;
|
|
9
|
+
int: number;
|
|
10
|
+
vit: number;
|
|
11
|
+
}
|
|
12
|
+
export interface QuestCompletions {
|
|
13
|
+
denofevil: boolean;
|
|
14
|
+
radamentslair: boolean;
|
|
15
|
+
thegoldenbird: boolean;
|
|
16
|
+
lamessenstome: boolean;
|
|
17
|
+
thefallenangel: boolean;
|
|
18
|
+
prisonofice: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface CharacterInfo {
|
|
21
|
+
name: string;
|
|
22
|
+
class: CharacterClass;
|
|
23
|
+
level: number;
|
|
24
|
+
stats: CharacterStats;
|
|
25
|
+
skills: Record<number, number>;
|
|
26
|
+
/** Quest completions per difficulty [normal, nightmare, hell]. */
|
|
27
|
+
quests: [QuestCompletions, QuestCompletions, QuestCompletions];
|
|
28
|
+
/** Mercenary data. */
|
|
29
|
+
mercName: number;
|
|
30
|
+
merc: string;
|
|
31
|
+
mercLevel: number;
|
|
32
|
+
}
|
|
33
|
+
export interface CharacterStatus {
|
|
34
|
+
hardcore: boolean;
|
|
35
|
+
died: boolean;
|
|
36
|
+
expansion: boolean;
|
|
37
|
+
ladder: boolean;
|
|
38
|
+
}
|
|
39
|
+
/** Result of parsing a .d2s character file. */
|
|
40
|
+
export interface D2SParseResult {
|
|
41
|
+
/** Character metadata. */
|
|
42
|
+
character: CharacterInfo;
|
|
43
|
+
/** Character status flags. */
|
|
44
|
+
status: CharacterStatus;
|
|
45
|
+
/** All items from the character file. */
|
|
46
|
+
items: LocatedItem[];
|
|
47
|
+
/** Warnings emitted during parsing. */
|
|
48
|
+
warnings: string[];
|
|
49
|
+
}
|
|
50
|
+
/** Result of parsing a .d2i shared stash file. */
|
|
51
|
+
export interface D2IParseResult {
|
|
52
|
+
/** Stash pages. */
|
|
53
|
+
pages: StashPage[];
|
|
54
|
+
/** All items across all pages. */
|
|
55
|
+
items: LocatedItem[];
|
|
56
|
+
/** Warnings emitted during parsing. */
|
|
57
|
+
warnings: string[];
|
|
58
|
+
}
|
|
59
|
+
export interface StashPage {
|
|
60
|
+
/** Zero-based page index. */
|
|
61
|
+
index: number;
|
|
62
|
+
/** Page type flag (0 = normal, 1 = extended, 2 = metadata). */
|
|
63
|
+
pageType: number;
|
|
64
|
+
/** Gold stored on this page. */
|
|
65
|
+
gold: number;
|
|
66
|
+
/** Items on this page. */
|
|
67
|
+
items: LocatedItem[];
|
|
68
|
+
}
|
|
69
|
+
export type SaveFileType = 'd2s' | 'd2i';
|
|
70
|
+
export interface DetectedFormat {
|
|
71
|
+
type: SaveFileType;
|
|
72
|
+
version: number;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=save-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-file.d.ts","sourceRoot":"","sources":["../../src/types/save-file.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIrD,MAAM,WAAW,cAAc;IAC7B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ClC,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAID,MAAM,WAAW,SAAS;IACxB,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAID,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,KAAK,CAAC;AAEzC,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-file.js","sourceRoot":"","sources":["../../src/types/save-file.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trade DTO — the shape sent from d2r-saver to the trade backend.
|
|
3
|
+
*/
|
|
4
|
+
import type { ItemQuality } from './constants.js';
|
|
5
|
+
/**
|
|
6
|
+
* Data Transfer Object for an item in the trading system.
|
|
7
|
+
* Contains everything the backend/frontend needs to display and filter items.
|
|
8
|
+
*/
|
|
9
|
+
export interface TradeItemDTO {
|
|
10
|
+
/** Base64 portability token for full item reconstruction. */
|
|
11
|
+
token: string;
|
|
12
|
+
/** 3-character base item code. */
|
|
13
|
+
baseCode: string;
|
|
14
|
+
/** Human-readable item name. */
|
|
15
|
+
displayName: string;
|
|
16
|
+
/** Item quality. */
|
|
17
|
+
quality: ItemQuality;
|
|
18
|
+
/** Item level. */
|
|
19
|
+
ilvl: number;
|
|
20
|
+
/** Ethereal flag. */
|
|
21
|
+
ethereal: boolean;
|
|
22
|
+
/** Number of sockets. */
|
|
23
|
+
sockets: number;
|
|
24
|
+
/** Unique/set/runeword ID (if applicable). */
|
|
25
|
+
uniqueId?: string;
|
|
26
|
+
/** Width in grid cells. */
|
|
27
|
+
width: number;
|
|
28
|
+
/** Height in grid cells. */
|
|
29
|
+
height: number;
|
|
30
|
+
/** Icon path/key for HD icon lookup in hditemlib. */
|
|
31
|
+
iconPath: string;
|
|
32
|
+
/** Key stats for search/filtering. */
|
|
33
|
+
stats: Record<string, number>;
|
|
34
|
+
/** Nested socketed items. */
|
|
35
|
+
socketedItems: TradeItemDTO[];
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=trade-item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trade-item.d.ts","sourceRoot":"","sources":["../../src/types/trade-item.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IAEd,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IAEjB,gCAAgC;IAChC,WAAW,EAAE,MAAM,CAAC;IAEpB,oBAAoB;IACpB,OAAO,EAAE,WAAW,CAAC;IAErB,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IAEb,qBAAqB;IACrB,QAAQ,EAAE,OAAO,CAAC;IAElB,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAEhB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IAEd,4BAA4B;IAC5B,MAAM,EAAE,MAAM,CAAC;IAEf,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IAEjB,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE9B,6BAA6B;IAC7B,aAAa,EAAE,YAAY,EAAE,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trade-item.js","sourceRoot":"","sources":["../../src/types/trade-item.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "d2r-saver",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Blizzless D2R (Diablo II: Resurrected v105) save file reader/writer for .d2s characters and .d2i shared stashes. Lossless writes preserve all save sections; supports item insert/extract and gold/attribute edits.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "TrayHard",
|
|
7
|
+
"homepage": "https://github.com/TrayHard/d2r-saver#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/TrayHard/d2r-saver.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/TrayHard/d2r-saver/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"diablo",
|
|
17
|
+
"diablo2",
|
|
18
|
+
"d2r",
|
|
19
|
+
"blizzless",
|
|
20
|
+
"save-file",
|
|
21
|
+
"save-editor",
|
|
22
|
+
"d2s",
|
|
23
|
+
"d2i",
|
|
24
|
+
"binary-parser",
|
|
25
|
+
"game-data"
|
|
26
|
+
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"main": "dist/index.js",
|
|
29
|
+
"types": "dist/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./data/data.json": "./data/data.json",
|
|
36
|
+
"./data/strings.json": "./data/strings.json",
|
|
37
|
+
"./package.json": "./package.json"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"data/data.json",
|
|
42
|
+
"data/strings.json",
|
|
43
|
+
"README.md",
|
|
44
|
+
"LICENSE"
|
|
45
|
+
],
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=18"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsc",
|
|
51
|
+
"build:data": "tsx src/data-parser/index.ts",
|
|
52
|
+
"prepare": "tsc",
|
|
53
|
+
"test": "vitest run",
|
|
54
|
+
"test:watch": "vitest",
|
|
55
|
+
"lint": "eslint src --ext .ts",
|
|
56
|
+
"prepublishOnly": "npm test && npm run build",
|
|
57
|
+
"release:patch": "npm version patch -m \"release: %s\" && npm publish && git push --follow-tags",
|
|
58
|
+
"release:minor": "npm version minor -m \"release: %s\" && npm publish && git push --follow-tags",
|
|
59
|
+
"release:major": "npm version major -m \"release: %s\" && npm publish && git push --follow-tags"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/node": "^22.19.13",
|
|
63
|
+
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
64
|
+
"@typescript-eslint/parser": "^8.32.1",
|
|
65
|
+
"eslint": "^9.27.0",
|
|
66
|
+
"tsx": "^4.21.0",
|
|
67
|
+
"typescript": "^5.8.3",
|
|
68
|
+
"vitest": "^3.1.0"
|
|
69
|
+
}
|
|
70
|
+
}
|