nokka / d2s Goto Github PK
View Code? Open in Web Editor NEWDiablo II file format binary parser written in Go.
License: MIT License
Diablo II file format binary parser written in Go.
License: MIT License
Hey, Great work on this project!
I've thrown together a project for listing items from all characters and the shared stash from PlugY using your library for parsing.
However. I had to rename the parseItem function to ParseItem to make it visible outside the d2s package.
Specifically here: https://github.com/Tejpbit/d2-item-lister/blob/master/main/main.go#L237
Would it be alright for you to expose that function in this project directly?
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
Hi there!
Magic attribute id = 57.
now: Adds 205-205 Poison Damage over 125 Seconds
expected: 100 poison damage over 5 seconds.
I fixed this problem in my Python library artcom-net/d2lib#3 .
If I find the time I will make a pull request.
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)
item.MagicalNameIDs
should be a fixed length array of 6. if you have a rare w/ 3 prefixes and 1 suffix you'd have an array of size 4 similar to
[143, 436, 583, 370]
as it is right now there is no way to distinguish between what is a prefix and what is a suffix. ideally you'd want something along the lines of.
[143, 436, 583, null, 370, null]
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
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).
Hi there!
The value of this attribute consists of two parts: 10 bits is the type raised and the next 7 bits is the percentage number.
The current implementation does not take into account the percentage value itself, which is an error.
I fixed this problem in my Python library artcom-net/d2lib#4.
If I find the time I will make a pull request.
Cold and lightning attributes are missing. IDs 51 and 55, respectively.
I fixed this problem in my Python library artcom-net/d2lib#2 .
If I find the time I will make a pull request.
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
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. ๐
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
where it give's + to pally skills instead of sorc.
While parsing some .d2s files from here
http://www.dethguild.com/diablo/diablo-character-packs/
e.g.
Level 99 Bone Necromancer
http://www.dethguild.com/wp-content/uploads/files/diablo/SilverDeth.d2s
I get errors like
Char name: SilverDeth, error that occurred: Unknown magical property: 25
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.