-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathotbm2json.js
723 lines (577 loc) · 19.8 KB
/
otbm2json.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
const fs = require("fs");
const HEADERS = require("./lib/headers");
const NODE_ESC = 0xFD;
const NODE_INIT = 0xFE;
const NODE_TERM = 0xFF;
__VERSION__ = "1.0.1";
function writeOTBM(__OUTFILE__, data) {
/*
* Function writeOTBM
* Writes OTBM from intermediary JSON structure
*/
// Write all nodes
fs.writeFileSync(__OUTFILE__, serializeOTBM(data));
}
function serializeOTBM(data) {
/*
* Function serializeOTBM
* Serializes OTBM from intermediary JSON structure
*/
function writeNode(node) {
/* FUNCTION writeNode
* Recursively writes all JSON nodes to OTBM node structure
*/
// Concatenate own data with children (recursively)
// and pad the node with start & end identifier
return Buffer.concat([
Buffer.from([NODE_INIT]),
writeElement(node),
Buffer.concat(getChildNode(node).map(writeNode)),
Buffer.from([NODE_TERM])
]);
}
function getChildNode(node) {
/* FUNCTION getChildNode
* Returns child node or dummy array if child does not exist
*/
return getChildNodeReal(node) || new Array();
}
function getChildNodeReal(node) {
/* FUNCTION getChildNodeReal
* Give children of a node a particular identifier
*/
switch(node.type) {
case HEADERS.OTBM_TILE_AREA:
return node.tiles;
case HEADERS.OTBM_TILE:
case HEADERS.OTBM_HOUSETILE:
return node.items;
case HEADERS.OTBM_TOWNS:
return node.towns;
case HEADERS.OTBM_ITEM:
return node.content;
case HEADERS.OTBM_MAP_DATA:
return node.features;
default:
return node.nodes;
}
}
function writeElement(node) {
/* FUNCTION Node.setChildren
* Give children of a node a particular identifier
*/
var buffer;
// Write each node type
switch(node.type) {
case HEADERS.OTBM_MAP_HEADER:
buffer = Buffer.alloc(17);
buffer.writeUInt8(HEADERS.OTBM_MAP_HEADER, 0);
buffer.writeUInt32LE(node.version, 1);
buffer.writeUInt16LE(node.mapWidth, 5);
buffer.writeUInt16LE(node.mapHeight, 7);
buffer.writeUInt32LE(node.itemsMajorVersion, 9);
buffer.writeUInt32LE(node.itemsMinorVersion, 13);
break;
case HEADERS.OTBM_MAP_DATA:
buffer = Buffer.alloc(1);
buffer.writeUInt8(HEADERS.OTBM_MAP_DATA, 0);
buffer = Buffer.concat([buffer, writeAttributes(node)]);
break;
case HEADERS.OTBM_TILE_AREA:
buffer = Buffer.alloc(6);
buffer.writeUInt8(HEADERS.OTBM_TILE_AREA, 0);
buffer.writeUInt16LE(node.x, 1);
buffer.writeUInt16LE(node.y, 3);
buffer.writeUInt8(node.z, 5);
break;
case HEADERS.OTBM_TILE:
buffer = Buffer.alloc(3);
buffer.writeUInt8(HEADERS.OTBM_TILE, 0);
buffer.writeUInt8(node.x, 1);
buffer.writeUInt8(node.y, 2);
buffer = Buffer.concat([buffer, writeAttributes(node)]);
break;
case HEADERS.OTBM_HOUSETILE:
buffer = Buffer.alloc(7);
buffer.writeUInt8(HEADERS.OTBM_HOUSETILE, 0);
buffer.writeUInt8(node.x, 1);
buffer.writeUInt8(node.y, 2);
buffer.writeUInt32LE(node.houseId, 3);
buffer = Buffer.concat([buffer, writeAttributes(node)]);
break;
case HEADERS.OTBM_ITEM:
buffer = Buffer.alloc(3);
buffer.writeUInt8(HEADERS.OTBM_ITEM, 0);
buffer.writeUInt16LE(node.id, 1);
buffer = Buffer.concat([buffer, writeAttributes(node)]);
break;
case HEADERS.OTBM_WAYPOINT:
buffer = Buffer.alloc(3 + node.name.length + 5);
buffer.writeUInt8(HEADERS.OTBM_WAYPOINT, 0);
buffer.writeUInt16LE(node.name.length, 1)
buffer.write(node.name, 3, "ASCII");
buffer.writeUInt16LE(node.x, 3 + node.name.length);
buffer.writeUInt16LE(node.y, 3 + node.name.length + 2);
buffer.writeUInt8(node.z, 3 + node.name.length + 4);
break;
case HEADERS.OTBM_WAYPOINTS:
buffer = Buffer.alloc(1);
buffer.writeUInt8(HEADERS.OTBM_WAYPOINTS, 0);
break;
case HEADERS.OTBM_TOWNS:
buffer = Buffer.alloc(1);
buffer.writeUInt8(HEADERS.OTBM_TOWNS, 0);
break;
case HEADERS.OTBM_TOWN:
buffer = Buffer.alloc(7 + node.name.length + 5);
buffer.writeUInt8(HEADERS.OTBM_TOWN, 0);
buffer.writeUInt32LE(node.townid, 1);
buffer.writeUInt16LE(node.name.length, 5)
buffer.write(node.name, 7, "ASCII");
buffer.writeUInt16LE(node.x, 7 + node.name.length);
buffer.writeUInt16LE(node.y, 7 + node.name.length + 2);
buffer.writeUInt8(node.z, 7 + node.name.length + 4);
break;
default:
throw("Could not write node. Unknown node type: " + node.type);
}
return escapeCharacters(buffer);
}
function escapeCharacters(buffer) {
/* FUNCTION escapeCharacters
* Escapes special 0xFD, 0xFE, 0xFF characters in buffer
*/
for(var i = 0; i < buffer.length; i++) {
if(buffer.readUInt8(i) === NODE_TERM || buffer.readUInt8(i) === NODE_INIT || buffer.readUInt8(i) === NODE_ESC) {
buffer = Buffer.concat([buffer.slice(0, i), Buffer.from([NODE_ESC]), buffer.slice(i)]); i++;
}
}
return buffer;
}
function writeASCIIString16LE(string) {
/* FUNCTION writeASCIIString16LE
* Writes an ASCII string prefixed with its string length (2 bytes)
*/
var buffer = Buffer.alloc(2 + string.length);
buffer.writeUInt16LE(string.length, 0);
buffer.write(string, 2, string.length, "ASCII");
return buffer;
}
function writeAttributes(node) {
/* FUNCTION writeAttributes
* Writes additional node attributes
*/
var buffer;
var attributeBuffer = Buffer.alloc(0);
if(node.destination) {
buffer = Buffer.alloc(6);
buffer.writeUInt8(HEADERS.OTBM_ATTR_TELE_DEST);
buffer.writeUInt16LE(node.destination.x, 1);
buffer.writeUInt16LE(node.destination.y, 3);
buffer.writeUInt8(node.destination.z, 5);
attributeBuffer = Buffer.concat([attributeBuffer, buffer]);
}
// Write description property
if(node.description) {
buffer = Buffer.alloc(1);
buffer.writeUInt8(HEADERS.OTBM_ATTR_DESCRIPTION, 0);
attributeBuffer = Buffer.concat([attributeBuffer, buffer, writeASCIIString16LE(node.description)])
}
// Node has an unique identifier
if(node.uid) {
buffer = Buffer.alloc(3);
buffer.writeUInt8(HEADERS.OTBM_ATTR_UNIQUE_ID, 0);
buffer.writeUInt16LE(node.uid, 1);
attributeBuffer = Buffer.concat([attributeBuffer, buffer]);
}
// Node has an action identifier
if(node.aid) {
buffer = Buffer.alloc(3);
buffer.writeUInt8(HEADERS.OTBM_ATTR_ACTION_ID, 0);
buffer.writeUInt16LE(node.aid, 1);
attributeBuffer = Buffer.concat([attributeBuffer, buffer]);
}
// Node has rune charges
if(node.runeCharges) {
buffer = Buffer.alloc(3);
buffer.writeUInt8(HEADERS.OTBM_ATTR_RUNE_CHARGES);
buffer.writeUInt16LE(node.runeCharges, 1);
attributeBuffer = Buffer.concat([attributeBuffer, buffer]);
}
// Spawn file
if(node.spawnfile) {
buffer = Buffer.alloc(1);
buffer.writeUInt8(HEADERS.OTBM_ATTR_EXT_SPAWN_FILE, 0);
attributeBuffer = Buffer.concat([attributeBuffer, buffer, writeASCIIString16LE(node.spawnfile)])
}
// Text attribute
if(node.text) {
buffer = Buffer.alloc(1);
buffer.writeUInt8(HEADERS.OTBM_ATTR_TEXT, 0);
attributeBuffer = Buffer.concat([attributeBuffer, buffer, writeASCIIString16LE(node.text)])
}
// House file
if(node.housefile) {
buffer = Buffer.alloc(1);
buffer.writeUInt8(HEADERS.OTBM_ATTR_EXT_HOUSE_FILE, 0);
attributeBuffer = Buffer.concat([attributeBuffer, buffer, writeASCIIString16LE(node.housefile)])
}
// Write HEADERS.OTBM_ATTR_ITEM
if(node.tileid) {
buffer = Buffer.alloc(3);
buffer.writeUInt8(HEADERS.OTBM_ATTR_ITEM, 0);
buffer.writeUInt16LE(node.tileid, 1);
attributeBuffer = Buffer.concat([attributeBuffer, buffer]);
}
// Write node count
if(node.count) {
buffer = Buffer.alloc(2);
buffer.writeUInt8(HEADERS.OTBM_ATTR_COUNT, 0);
buffer.writeUInt8(node.count, 1);
attributeBuffer = Buffer.concat([attributeBuffer, buffer]);
}
// Write depot identifier
if(node.depotId) {
buffer = Buffer.alloc(3);
buffer.writeUInt8(HEADERS.OTBM_ATTR_DEPOT_ID, 0);
buffer.writeUInt16LE(node.depotId, 1);
attributeBuffer = Buffer.concat([attributeBuffer, buffer]);
}
// Write house door ID
if(node.houseDoorId) {
buffer = Buffer.alloc(2);
buffer.writeUInt8(HEADERS.OTBM_ATTR_HOUSEDOORID, 0);
buffer.writeUInt8(node.houseDoorId, 1);
attributeBuffer = Buffer.concat([attributeBuffer, buffer]);
}
// Write the zone fields
if(node.zones) {
buffer = Buffer.alloc(5);
buffer.writeUInt8(HEADERS.OTBM_ATTR_TILE_FLAGS, 0);
buffer.writeUInt32LE(writeFlags(node.zones), 1);
attributeBuffer = Buffer.concat([attributeBuffer, buffer]);
}
return attributeBuffer;
}
function writeFlags(zones) {
/* FUNCTION writeFlags
* Writes OTBM tile bit-flags to integer
*/
var flags = HEADERS.TILESTATE_NONE;
flags |= zones.protection && HEADERS.TILESTATE_PROTECTIONZONE;
flags |= zones.noPVP && HEADERS.TILESTATE_NOPVP;
flags |= zones.noLogout && HEADERS.TILESTATE_NOLOGOUT;
flags |= zones.PVPZone && HEADERS.TILESTATE_PVPZONE;
flags |= zones.refresh && HEADERS.TILESTATE_REFRESH;
return flags;
}
// OTBM Header
const VERSION = Buffer.alloc(4).fill(0x00);
// Write all nodes
return Buffer.concat([VERSION, writeNode(data.data)]);
}
function readOTBM(__INFILE__) {
/* FUNCTION readOTBM
* Reads OTBM file to intermediary JSON structure
*/
var Node = function(data, children) {
/* CLASS Node
* Holds a particular OTBM node of type (see below)
*/
// Remove the escape character from the node data string
data = this.removeEscapeCharacters(data);
switch(data.readUInt8(0)) {
case HEADERS.OTBM_MAP_HEADER:
this.type = HEADERS.OTBM_MAP_HEADER;
this.version = data.readUInt32LE(1),
this.mapWidth = data.readUInt16LE(5),
this.mapHeight = data.readUInt16LE(7),
this.itemsMajorVersion = data.readUInt32LE(9),
this.itemsMinorVersion = data.readUInt32LE(13)
break;
// High level map data (e.g. areas, towns, and waypoints)
case HEADERS.OTBM_MAP_DATA:
this.type = HEADERS.OTBM_MAP_DATA;
Object.assign(this, readAttributes(data.slice(1)));
break;
// A tile area
case HEADERS.OTBM_TILE_AREA:
this.type = HEADERS.OTBM_TILE_AREA;
this.x = data.readUInt16LE(1);
this.y = data.readUInt16LE(3);
this.z = data.readUInt8(5);
break;
// A specific tile at location inside the parent tile area
case HEADERS.OTBM_TILE:
this.type = HEADERS.OTBM_TILE;
this.x = data.readUInt8(1);
this.y = data.readUInt8(2);
Object.assign(this, readAttributes(data.slice(3)));
break;
// A specific item inside the parent tile
case HEADERS.OTBM_ITEM:
this.type = HEADERS.OTBM_ITEM;
this.id = data.readUInt16LE(1);
Object.assign(this, readAttributes(data.slice(3)));
break;
// Parse HEADERS.OTBM_HOUSETILE entity
case HEADERS.OTBM_HOUSETILE:
this.type = HEADERS.OTBM_HOUSETILE;
this.x = data.readUInt8(1);
this.y = data.readUInt8(2);
this.houseId = data.readUInt32LE(3);
Object.assign(this, readAttributes(data.slice(7)));
break;
// Parse HEADERS.OTBM_WAYPOINTS structure
case HEADERS.OTBM_WAYPOINTS:
this.type = HEADERS.OTBM_WAYPOINTS;
break;
// Single waypoint entity
case HEADERS.OTBM_WAYPOINT:
this.type = HEADERS.OTBM_WAYPOINT;
this.name = readASCIIString16LE(data.slice(1));
this.x = data.readUInt16LE(3 + this.name.length);
this.y = data.readUInt16LE(5 + this.name.length);
this.z = data.readUInt8(7 + this.name.length);
break;
// Parse HEADERS.OTBM_TOWNS
case HEADERS.OTBM_TOWNS:
this.type = HEADERS.OTBM_TOWNS;
break;
// Single town entity
case HEADERS.OTBM_TOWN:
this.type = HEADERS.OTBM_TOWN;
this.townid = data.readUInt32LE(1);
this.name = readASCIIString16LE(data.slice(5));
this.x = data.readUInt16LE(7 + this.name.length);
this.y = data.readUInt16LE(9 + this.name.length);
this.z = data.readUInt8(11 + this.name.length);
break;
}
// Set node children
if(children.length) {
this.setChildren(children);
}
}
Node.prototype.removeEscapeCharacters = function(nodeData) {
/* FUNCTION removeEscapeCharacter
* Removes 0xFD escape character from the byte string
*/
var iEsc = 0;
var index;
while(true) {
// Find the next escape character
index = nodeData.slice(++iEsc).indexOf(NODE_ESC);
// No more: stop iteration
if(index === -1) {
return nodeData;
}
iEsc = iEsc + index;
// Remove the character from the buffer
nodeData = Buffer.concat([
nodeData.slice(0, iEsc),
nodeData.slice(iEsc + 1)
]);
}
};
Node.prototype.setChildren = function(children) {
/* FUNCTION Node.setChildren
* Give children of a node a particular identifier
*/
switch(this.type) {
case HEADERS.OTBM_TILE_AREA:
this.tiles = children;
break;
case HEADERS.OTBM_TILE:
case HEADERS.OTBM_HOUSETILE:
this.items = children;
break;
case HEADERS.OTBM_TOWNS:
this.towns = children;
break;
case HEADERS.OTBM_ITEM:
this.content = children;
break;
case HEADERS.OTBM_MAP_DATA:
this.features = children;
break;
default:
this.nodes = children;
break;
}
};
function readASCIIString16LE(data) {
/* FUNCTION readASCIIString16LE
* Reads a string of N bytes with its length
* deteremined by the value of its first two bytes
*/
return data.slice(2, 2 + data.readUInt16LE(0)).toString("ASCII");
}
function readAttributes(data) {
/* FUNCTION readAttributes
* Parses a nodes attribute structure
*/
var i = 0;
// Collect additional properties
var properties = new Object();
// Read buffer from beginning
while(i + 1 < data.length) {
// Read the leading byte
switch(data.readUInt8(i++)) {
// Text is written
case HEADERS.OTBM_ATTR_TEXT:
properties.text = readASCIIString16LE(data.slice(i));
i += properties.text.length + 2;
break;
// Spawn file name
case HEADERS.OTBM_ATTR_EXT_SPAWN_FILE:
properties.spawnfile = readASCIIString16LE(data.slice(i));
i += properties.spawnfile.length + 2;
break;
// House file name
case HEADERS.OTBM_ATTR_EXT_HOUSE_FILE:
properties.housefile = readASCIIString16LE(data.slice(i));
i += properties.housefile.length + 2;
break;
// House door identifier (1 byte)
case HEADERS.OTBM_ATTR_HOUSEDOORID:
properties.houseDoorId = data.readUInt8(i);
i += properties.houseDoorId.length + 2;
break;
// Description is written (N bytes)
// May be written multiple times
case HEADERS.OTBM_ATTR_DESCRIPTION:
var descriptionString = readASCIIString16LE(data.slice(i));
if(properties.description) {
properties.description = properties.description + " " + descriptionString;
} else {
properties.description = descriptionString;
}
i += descriptionString.length + 2;
break;
// Description is written (N bytes)
case HEADERS.OTBM_ATTR_DESC:
properties.text = readASCIIString16LE(data.slice(i));
i += properties.text.length + 2;
break;
// Depot identifier (2 byte)
case HEADERS.OTBM_ATTR_DEPOT_ID:
properties.depotId = data.readUInt16LE(i);
i += 2;
break;
// Tile flags indicating the type of tile (4 Bytes)
case HEADERS.OTBM_ATTR_TILE_FLAGS:
properties.zones = readFlags(data.readUInt32LE(i));
i += 4;
break;
// N (2 Bytes)
case HEADERS.OTBM_ATTR_RUNE_CHARGES:
properties.runeCharges = data.readUInt16LE(i);
i += 2;
break;
// The item count (1 byte)
case HEADERS.OTBM_ATTR_COUNT:
properties.count = data.readUInt8(i);
i += 1;
break;
// The main item identifier (2 bytes)
case HEADERS.OTBM_ATTR_ITEM:
properties.tileid = data.readUInt16LE(i);
i += 2;
break;
// Action identifier was set (2 bytes)
case HEADERS.OTBM_ATTR_ACTION_ID:
properties.aid = data.readUInt16LE(i);
i += 2;
break;
// Unique identifier was set (2 bytes)
case HEADERS.OTBM_ATTR_UNIQUE_ID:
properties.uid = data.readUInt16LE(i);
i += 2;
break;
// Teleporter given destination (x, y, z using 2, 2, 1 bytes respectively)
case HEADERS.OTBM_ATTR_TELE_DEST:
properties.destination = {
"x": data.readUInt16LE(i),
"y": data.readUInt16LE(i + 2),
"z": data.readUInt8(i + 4)
}
i += 5;
break;
}
}
return properties;
}
function readFlags(flags) {
/* FUNCTION readFlags
* Reads OTBM bit flags
*/
// Read individual tile flags using bitwise AND &
return {
"protection": flags & HEADERS.TILESTATE_PROTECTIONZONE,
"noPVP": flags & HEADERS.TILESTATE_NOPVP,
"noLogout": flags & HEADERS.TILESTATE_NOLOGOUT,
"PVPZone": flags & HEADERS.TILESTATE_PVPZONE,
"refresh": flags & HEADERS.TILESTATE_REFRESH
}
}
function readNode(data) {
/* FUNCTION readNode
* Recursively parses OTBM nodal tree structure
*/
// Cut off the initializing 0xFE identifier
data = data.slice(1);
var i = 0;
var children = new Array();
var nodeData = null;
var child;
// Start reading the array
while(i < data.length) {
var cByte = data.readUInt8(i);
// Data belonging to the parent node, between 0xFE and (OxFE || 0xFF)
if(nodeData === null && (cByte === NODE_INIT || cByte === NODE_TERM)) {
nodeData = data.slice(0, i);
}
// Escape character: skip reading this and following byte
if(cByte === NODE_ESC) {
i = i + 2;
continue;
}
// A new node is started within another node: recursion
if(cByte === NODE_INIT) {
child = readNode(data.slice(i));
children.push(child.node);
// Skip index over full child length
i = i + 2 + child.i;
continue;
}
// Node termination
if(cByte === NODE_TERM) {
return {
"node": new Node(nodeData, children),
"i": i
}
}
i++;
}
}
const data = fs.readFileSync(__INFILE__);
// First four magic bytes are the format identifier
const MAP_IDENTIFIER = data.readUInt32LE(0);
// Confirm OTBM format by reading magic bytes (NULL or "OTBM")
if(MAP_IDENTIFIER !== 0x00000000 && MAP_IDENTIFIER !== 0x4D42544F) {
throw("Unknown OTBM format: unexpected magic bytes.");
}
// Create an object to hold the data
var mapData = {
"version": __VERSION__,
"identifier": MAP_IDENTIFIER,
"data": readNode(data.slice(4)).node
}
return mapData;
}
module.exports.read = readOTBM;
module.exports.write = writeOTBM;
module.exports.serialize = serializeOTBM;
module.exports.HEADERS = HEADERS;
module.exports.__VERSION__ = __VERSION__;