Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const {
createSplitter,
decompress,
d2gsProtocol,
d2gsReader
} = require('../..')
const ProtoDef = require('protodef').ProtoDef
const FullPacketParser = require('protodef').FullPacketParser
const protoToClient = new ProtoDef(false)
protoToClient.addTypes(d2gsReader)
protoToClient.addProtocol(d2gsProtocol, ['toClient'])
const parser = new FullPacketParser(protoToClient, 'packet')
parser.on('error', err => console.log('d2gsToClient error : ', err.message))
const splitter = createSplitter()
const fs = require('fs')
const dumpFile = fs.readFileSync('./d2gs.dump')
console.log(dumpFile.slice(0, 7))
const cleanedDumpFile = dumpFile.slice(7)
console.log(cleanedDumpFile.length)
async function load () {
let lastOffset = 0
function createDeserializer ({ state = states.HANDSHAKING, isServer = false, version, customPackets } = {}) {
return new Parser(createProtocol(state, isServer ? 'toServer' : 'toClient', version, customPackets), 'packet')
}