Skip to content

Dota Underlords share codes encoding & decoding in TypeScript

License

Notifications You must be signed in to change notification settings

ThomasK33/node-underlords

Repository files navigation

Node-Underlords

GitHub package.json version Node.js CI Coverage Status node-current NPM

TypeScript / JavaScript library for Dota Underlords.


Features

  • Share code parsing
  • Share code encoding

Installation

This is a Node.js module available through the NPM registry and GitHub Packages.

Before installing, please download and install a Node.js version greater or equal to 10.0.

Installation of the module is done using the npm install command:

npm install underlords

Quick Start

import { ShareCodeV8 } from "underlords";

// Parse an Underlords share code to a ShareCodeV8 instance
const shareCodeString =
	"8qAMAAP4BAK4BAATjJ/5uAEZuAAAgEVM0LgAAAG0AbQAACwAAAP8BDAABCRsI/wAJARcBAQAOAQUBAQAGES0QbUBHOlcBEmoBAAFIACABaBABAyAAEAEpLAIgIAAwAAAGAgEgAAWCAHUR2gB0EQkBAQRjAAVyLBAAAgABBAMGdycAdy4fAK4BAA==";
const shareCode = ShareCodeV8.fromBase64String(shareCodeString);

// Log board unit at index 0x0
console.log(shareCode.boardUnitIDs[0][0]);
// -> 32 (Abaddon)

// Log unit item at index 4x4
console.log(shareCode.unitItems[4][4].itemID);
// -> 10211 (maelstrom_rot1)

// Change unit at 0x0 to unit id 46 (Alchemist)
shareCode.boardUnitIDs[0][0] = 46;

const resultingShareCode = shareCode.toBase64String();
// -> 8qAMAAP4BAK4BAATjJ/5uAEZuAAAuEVMBCThtAG0AAAsAAAD/AABtAAEJGwj/AAkBFwEBAA4BBQEBBAYAASEcbQAAbUBHOlcBEmoBAAFIJCAgAAAAAQMgABABKTACICAAMAAABgIBIAAAARoAdRHaAHQRCQEBBGMABXIsEAACAAEEAwZ3JwB3Lh8ArgEA

For all available fields, visit the API Docs of the current share code.

For unit and items ids, visit the Fortify Repo.

Docs & Community

Contributing

Contributing Guide

License

MIT

Disclaimer

This project is not affiliated with Valve Corporation. Dota Underlords, Dota and Steam are registered trademarks of Valve Corporation.