Giter VIP home page Giter VIP logo

d2d2s's Introduction

CircleCI Go Report Card GoDoc codecov

Description

This package contains a Diablo II save files (D2S) decoder and encoder written in golang

Dependencies / Documentation

D2S structure documentation:

I depend on

This project uses Data stream writer based on these used in OpenDiablo2 project for more informations, see here

Status

for now (May 2021) the project is early in development. However, it is possible to:

  • decode character save file into a (in a greater part) human-readable structure
  • encoding file

Example

for some reasons, this project isn't able to create a whole new file yet, but it is able to load modify and than encode D2S format

simple example
package main

import (
        "fmt"
        "ioutil"
        "log"

        "github.com/gucio321/d2d2s/pkg/d2s"
)

func main() {
        data, err := ioutil.ReadFile("/path/to/file.d2s")
        if err != nil {
                log.Fatal(err)
        }

        character, err := d2s.Unmarshal(data)
        if err != nil {
                log.Fatal(err)
        }

        // some edits

        newData, err := d2d2s.Encode(character)
        if err != nil {
                log.fatal(err)
        }

        if err := ioutil.WriteFile("/path/to/new/file.d2s", newData, 0o600); err != nil {
                log.Fatal("error writing file")
        }
}

for more examples, see here

Goals of the project

this programm should be able to decode, encode and create a new D2S files

Legal Notes

Diablo 2 and its content is ©2000 Blizzard Entertainment, Inc. All rights reserved. Diablo and Blizzard Entertainment are trademarks or registered trademarks of Blizzard Entertainment, Inc. in the U.S. and/or other countries.

This package is ABSOLUTLY NO WARRITY! The code developers aren't responsible for any damage caused by this software or illegal uses of it!

Custom D2S Files

Sometimes, you may want to parse some custom d2s files. For example these created by certain d2 mods. They are not supported by default, however you can do some configuration to support them.

NOTE: add this code in your custom implementation of package or modify cmd/editor

NOTE: in case of any problems/errors please fill an issue in this repo!

        myD2S := d2s.New()
        m := map[d2sstats.StatID]int{
                d2sstats.Strength:       11,
                d2sstats.Energy:         11,
                d2sstats.Dexterity:      11,
                d2sstats.Vitality:       11,
                d2sstats.UnusedStats:    11,
                d2sstats.UnusedSkills:   8,
                d2sstats.CurrentHP:      21,
                d2sstats.MaxHP:          21,
                d2sstats.CurrentMana:    21,
                d2sstats.MaxMana:        21,
                d2sstats.CurrentStamina: 21,
                d2sstats.MaxStamina:     21,
                d2sstats.Level:          8,
                d2sstats.Experience:     32,
                d2sstats.Gold:           22,
                d2sstats.StashedGold:    25,
                88:                      48,
        }

        myD2S.Stats.UserStatMap(m)
        myD2S.Skills.SetSkillsCount(95)
        myD2S.Items.IgnoreErrors()

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.