Coder Social home page Coder Social logo

Comments (3)

nokka avatar nokka commented on September 28, 2024

Hello, thanks for your input, this started as a pet project of my own to learn Go back in 2016, I've been working with it professionally and on my spare time since then so this project could definitely use some refactoring to meet the demands of people now that it's being used for more than just the Slashdiablo armory. I recently extended the public API a bit because I needed to access some things in a consumer project of the library so I think your proposed changes would make a great addition.

What did you have in mind, just all the codes as constants and then refactor to use them for things such as the weapon type map?

Make a pull request if you want to merge your forked changes and let's have a look!

from d2s.

jordanbrauer avatar jordanbrauer commented on September 28, 2024

What did you have in mind

I have a few ideas, but to start I think that refactoring item codes will be one PR. I will open a new issue & PR after this one, but all the ideas I have would work towards making a good developer experience – both contributing to and consuming this package. I'll put details in a new issue & PR though.

Make a pull request if you want to merge your forked changes and let's have a look!

👍 Sounds great – will submit that right away!

from d2s.

mgamperl avatar mgamperl commented on September 28, 2024

Hi,
I am using this awesome library for a tool I'm developing (Plugy Item Sorter and Holy Grail List) and I really much like the idea of the refactoring of items codes to constants.

In fact I have some code ready in my own branch / my own repo which I could provide if you guys are interested.
It is based on @jordanbrauer s merge request but I added / fixed some things using information available on the web or from d2data ( (like correct TypeNames, sizes, ..)

Here are some examples of what it looks like

ItemTypes with typed constants:

type ItemType string

// Item code value constant used as an internal reference or "ID".
const (
	// Armor
	AlphaHelm         ItemType = "dr6"
	AncientArmor      ItemType = "aar"
	Antlers           ItemType = "dr3"
	ArchonPlate       ItemType = "utp"
	Armet             ItemType = "ulm"
	AssaultHelmet     ItemType = "ba4"
	AvengerGuard      ItemType = "ba5"

Unique Item List:

var UniqueItems = map[uint64]UniqueItem{
	0:   {ItemType: d2s.HandAxe, Name: "The Gnasher"},
	1:   {ItemType: d2s.Axe, Name: "Deathspade"},
	2:   {ItemType: d2s.DoubleAxe, Name: "Bladebone"},
	3:   {ItemType: d2s.MilitaryPick, Name: "Mindrend"},
	4:   {ItemType: d2s.WarAxe, Name: "Rakescar"},

Set Item List

var SetItems = map[uint64]SetItem{
	0:   {ItemType: d2s.LargeShield, SetName: "Civerb's Vestments", Name: "Civerb's Ward"},
	1:   {ItemType: d2s.Amulet, SetName: "Civerb's Vestments", Name: "Civerb's Icon"},
	2:   {ItemType: d2s.GrandScepter, SetName: "Civerb's Vestments", Name: "Civerb's Cudgel"},
	3:   {ItemType: d2s.ChainBoots, SetName: "Hsarus' Defense", Name: "Hsaru's Iron Heel"},
	4:   {ItemType: d2s.Buckler, SetName: "Hsarus' Defense", Name: "Hsaru's Iron Fist"},

Also some additonal item information based on the type (the categories are not final yet, I have to put more thought into this but ItemQuality and SizeX and SizeY I could provide now.

var itemPropertyMap = map[d2s.ItemType]*ItemPropertyData{
           // War Hammer
	d2s.Maul:                          {ItemQuality: ItemQualityNormal, SizeX: 2, SizeY: 4, ItemCategory: Weapons, ItemSubCategory: HammersAndMaces, ItemSubSubCategory: Hammers},              // Maul
	d2s.GreatMaul:                     {ItemQuality: ItemQualityNormal, SizeX: 2, SizeY: 3, ItemCategory: Weapons, ItemSubCategory: HammersAndMaces, ItemSubSubCategory: Hammers},              // Great Maul
	d2s.Cudgel:                        {ItemQuality: ItemQualityExceptional, SizeX: 1, SizeY: 3, ItemCategory: Weapons, ItemSubCategory: HammersAndMaces, ItemSubSubCategory: Maces},           // Cudgel
	d2s.BarbedClub:                    {ItemQuality: ItemQualityExceptional, SizeX: 1, SizeY: 3, ItemCategory: Weapons, ItemSubCategory: HammersAndMaces, ItemSubSubCategory: Maces},  

Let me know if you would accept a merge request then I will put more work into it otherwise I will keep this in my own fork.

from d2s.

Related Issues (13)

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.