/diablo2-protocol

Diablo 2 network protocol

Primary LanguageJavaScriptMIT LicenseMIT

diablo2-protocol

NPM version Build Status Discord Chat Try it on gitpod

Network protocol for diablo 2 : create client and servers for diablo 1.13 and 1.14.

Bot example

Sniffer example

Installation

npm install diablo2-protocol

Usage

Follow bot in a few lines

const { createClientDiablo } = require('diablo2-protocol')

async function start () {
  const clientDiablo = await createClientDiablo({
    host: 'battlenetIp',
    username: 'myUser',
    password: 'myPassword',
    version: '1.14',
    keyClassic: 'my16CharsKey',
    keyExtension: 'my16CharsKey'
  })
  clientDiablo.on('D2GS_PLAYERMOVE', ({ targetX, targetY }) => {
    clientDiablo.write('D2GS_RUNTOLOCATION', {
      x: targetX,
      y: targetY
    })
  })

  await clientDiablo.selectCharacter('mycharacter')
  await clientDiablo.createGame('mygame', '', '21', 0)
  console.log('Has joined the game')
}

start()

See docs/API.md

Follow bot example

node examples/simpleBot.js [-h] [-v] -au USERNAME -ap PASSWORD -c CHARACTER -gn \
                    GAMENAME -gp GAMEPASSWORD -gs GAMESERVER -s SIDSERVER \
                    [-dv DIABLOVERSION] -k1 KEYCLASSIC -k2 KEYEXTENSION

Sniffer (Linux / MacOS only)

cd example/sniffer
npm install
sudo node sniffer.js

Projects using diablo-protocol

  • diablo2-live-viewer displaying a live diablo map and live packets table
  • AutoTathamet Create Diablo2 bots with a powerful, stable, and high level JavaScript API.

Roadmap

  • Test all packets
  • Sniffer
  • more documentation
  • Proxy ?
  • More examples
  • Web / mobile interface

Docs

Diablo

Libs