Coder Social home page Coder Social logo

d2s's People

Contributors

artcom-net avatar dschu012 avatar nokka avatar squeek502 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

d2s's Issues

bit 48 on items

https://github.com/nokka/d2s/blob/master/d2s.go#L800

at offset 48 is an 8 bit version number having one of the following values.

0 = pre-1.08; 1 = 1.08/1.09 normal; 2 = 1.10 normal; 100 = 1.08/1.09 expansion; 101 = 1.10 expansion

credits to https://github.com/nickshanks/Alkor/blob/master/Source/Item.m#L103 for the info. it is important if u want to be able to rebuild the d2s from your json output. if the version is wrong you can get weird stuff like

image

where it give's + to pally skills instead of sorc.

index out of range

The following program crashes with "index out of range":

package main

import (
	"strings"

	"github.com/nokka/d2s"
)

var data = "00000000000000000000" +
	"00000000000000000000" +
	"\x000000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"00000000000000000000" +
	"0000000\r0000\x1c000x000" +
	"\xe2?if0000000000000000" +
	"00000000000000JM00JM" +
	"00000\xda"

func main() {
	d2s.Parse(strings.NewReader(data))
}

(found with go-fuzz)

Plans for Diablo II Resurrected (1.15) support

Any consideration on supporting save file format for D2R? I found this post on Phrozen Keep

Differences:

Version 1 higher (x97 not x96)
Last dword before quest data (before Woo!) needs to be 1 not 0.
Items don't have JM header anymore (item blocks still do)
Item IDs use huffman encoding.
The "number of socketed items" field after ID appears to be 1 bit for simple items.

My thinking is that we can use the character version as a check to handle and parse things differently. Right now it seems to be the items that aren't parsed properly, and the mercenary (JM and jf headers).

5-bit set IDs theory

d2s/item.go

Line 458 in db00d42

Is there a chance there could be more info lurking in this 5 bit value? The decoding appears to just be a count of the number of ones in the binary number. The position of the bits may indicate how many set pieces are needed to activate the bonus, for example. I was thinking about the best way to get the set bonuses working, and this would be some nice info to have if that's how it works. I might try to dig through the binary myself at some point, but thought I'd ask here first.

--M81 from slash discord

make item codes available through constants (similar to class.go)

Hello there! I will start by saying, great job on this lib! I do not personally play on the slash servers (though did at one point many years ago), but do play single player and have always been fascinated with Diablo II save & item files.

Your library is what I chose to use for my own pet project and as I used it, I noticed that many types & constants are not exported for consumer use. I would like to propose a change for this! To start, I feel that exposing item codes as named constants would make for good dev experience for both contributors & consumers. For (a silly) example, we can reference & check the item.Type field against a nice constant, such as the obscure zweihander code 9fb among many many others,

func isZweihander(item d2s.Item) bool {
    return d2s.Zweihander == item.Type
}

This is particularly nice & useful for other files, variables, and constants that need to use the item type codes (such as socketables.go, and the item.go variables weaponDamageMap and quantityMap, etc), preventing duplication and accidental typos by providing autocomplete if your editor/IDE supports it, especially as new bits are decoded and this package continues to grow.

I see that you already have the same pattern in the class.go file.

Will be interested to hear what you think. If you'd like, I also already have a branch on a fork that I can submit as PR for review, as I needed this for my own project. ๐Ÿ™‚

char name: nokka

Hi i testet you go module and get this error.
2021/09/22 18:14:58 char name: nokka, unknown magical property: 499
and the name is nokka and in the same directory as the programm
exited with code=1 in 0.511 seconds

New magic property

Hi there!
When I wrote an implementation for Python, I discovered something missing a magic property, it is with ID = 49 and is called '{} to Maximum Fire Damage' (Cathan's Rule). Sorry for my bad english (maybe). Pull request: #7

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.