GithubHelp home page GithubHelp logo

justiceandy / d2mapapi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jcageman/d2mapapi

0.0 1.0 0.0 50 KB

d2 map rest API to retrieve the map layout per area given a map seed

License: MIT License

C++ 59.24% C 40.76%

d2mapapi's Introduction

d2mapapi

Diablo II map rest API to retrieve the map layout per area given a map seed

A diablo 2 1.13C installation is required, but this API should work for all versions of diablo 2. Do note that for 1.09 and lower, higher difficulties do not generate larger maps, hence when interfacing with the API, always use difficulty = 0 (normal).

Installation

First install vcpkg

Windows

git clone https://github.com/microsoft/vcpkg
.\vcpkg\bootstrap-vcpkg.bat

Unix

git clone https://github.com/microsoft/vcpkg
.\vcpkg\bootstrap-vcpkg.sh

The binary will be located here .\vcpkg\vcpkg, make sure to include the absolute path to this in your system path environment variable and restart your shell. Once done setup a vcpkg integration by running:

vcpkg integrate install

If you are using Visual Studio to build this project, vcpkg dependencies will be automatically installed and included to this repository. If not, you will need to manually fetch and include the following packages:

vcpkg install boost-uuid
vcpkg install restinio
vcpkg install json-dto

You should now be able to build d2mapapi.sln

Usage

Syntax:

d2mapapi.exe {pathToDiablo2} [optionalArguments]

Optional Arguments

* -i or --ip
    specify an IP address to use instead of localhost. ex: `-i 192.168.0.1` OR `--ip=192.168.0.1`";
* -p or --port
    specify n port address to use instead of the default 8080. ex: `-p 8080` OR `--port=8080`";
* -h or --help
    display usage information

Examples

d2mapapi.exe "C:\Diablo II1.13c"
d2mapapi.exe "C:\Diablo II1.13c" --ip=0.0.0.0 --port=88
d2mapapi.exe "C:\Diablo II1.13c" --port=80

Running in Docker

This requires Docker Desktop

Example Dockerfile:

FROM tianon/wine
ENV WINEARCH=win32
ENV WINEDEBUG=-all
# change this to your Diablo 2 installation
COPY [ "C:\Diablo II1.13c", "/app/game" ]
WORKDIR /app
# d2mapapi should be in the same folder as your dockerfile
COPY ./d2mapapi .
EXPOSE 8080
CMD ["wine", "d2mapapi.exe", "/app/game", "--ip=0.0.0.0"]

Download the latest release

Place the d2mapapi folder the dockerfile in the same folder, and navigate their via command line then run docker build -t d2mapapi .

Once that completes run docker run d2mapapi

API

POST localhost:8080/sessions/ -- starts a new session (difficulty 0,1 or 2 (2 = hell))

{
    "difficulty" : 2, 
    "mapid" : 405387119
}

DELETE localhost:8080/sessions/{{sessionId}} -- cleans up the session (every new game is a session)

GET localhost:8080/sessions/{{sessionId}}/areas/35 -- retrieves the map information for catacombs 2 (area 35)

d2mapapi's People

Contributors

jcageman avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.