LartTyler / MHWDB-Docs

API documentation for the Monster Hunter World API (https://mhw-db.com)
Other
62 stars 6 forks source link

Charms data rearrangement #4

Closed RayLuxembourg closed 6 years ago

RayLuxembourg commented 6 years ago

Example: currently Poison Charm 1 and Poison Charm 2 are living separately

if you could please arrange them like you did with skills

Poison Charm :{
 ranks:[
  {name:Poison Charm 1},
 {name:Poison Charm 2}...
]

}

It would be great just to show charms and then show possible upgrades and levels separately.

LartTyler commented 6 years ago

What are you trying to accomplish with this change? If I did something similar to the crafting.branches field on weapons, would that work? I'd like to avoid making any changes that could cause other projects using the API to break.

RayLuxembourg commented 6 years ago

@LartTyler hey. the thing is same charm is displayed multiple times, for example imagine calling /skill end point and receiving same skill but different level like Attack boost 1 Attack boost 2 Instead of just getting the attack boost skill.

LartTyler commented 6 years ago

Yeah, that's a good point. Lemme think on this, since it's going to change how I end up implementing crafting / upgrade costs for charms, but I think you're right, it does make more sense that they'd all be under the same umbrella object.

LartTyler commented 6 years ago

So here are my two ideas for how this restructure should look. I'd love some input on which one looks better.

This first one would kind of achieve what you're asking. It would allow you to relate one charm to another, and it would do so without breaking backwards compatibility.

{
  "name": "Poison Charm 1",
  "skills": [
    {
      "skill": 1,
      "level": 1,
      "description": "Reduces the duration of poison by 30%.",
      "modifiers": [],
      "id": 1,
      "slug": "poison-resistance-rank-1"
    }
  ],
  "id": 1,
  "slug": "poison-charm-1",
  "crafting": {
    "craftable": true,
    "previous": null,
    "next": 2
  }
}

In that example, it uses a similarly styled Crafting object to what I recently implemented on weapons, except that instead of the possible upgrades being an array of IDs, it's just a single ID, since (to my knowledge) no charms have a branching upgrade path. It would also allow me to easily add crafting and upgrade costs in a future update by adding a craftingMaterials and upgradeMaterials fields to the Crafting object.

The second option would break backwards compatibility (something I'd prefer to avoid, but it might not be possible to), would be to do what you suggested, and use a format similar to skills.

{
  "name": "Poison Charm",
  "id": 1,
  "ranks": [
    {
      "id": 1,
      "name": "Poison Charm 1",
      "skills": [
        {
          "skill": 1,
          "level": 1,
          "description": "Reduces the duration of poison by 30%.",
          "modifiers": [],
          "id": 1,
          "slug": "poison-resistance-rank-1"
        }
      ]
    }
  ]
}

I could still add things like crafting costs, but it would look really weird in my opinion, since you'd have items in the rank array directly referencing other items in the array.

RayLuxembourg commented 6 years ago

@LartTyler options 2 is much more logical structure. You don't really have to keep the name "Poison charm 1" because it's just a level like in skills.

HumbertoMendes commented 6 years ago

Since you're going to change the charms, is it possible to add their rarity as well?

LartTyler commented 6 years ago

@HumbertoMendes Yeah, I can add that. It might take a little longer though, since neither Kiranico nor the Monster Hunter wikia list rarity for charms. The only place I can find it is on https://monsterhunterworld.wiki.fextralife.com, which I don't have a scraper for just yet. I'll add it to my backlog.

RayLuxembourg commented 6 years ago

@LartTyler please add materials for craft/upgrade as well.

LartTyler commented 6 years ago

@RayLuxembourg Yep, material costs for charms (and armor as well) is in the works.

LartTyler commented 6 years ago

The feedback you guys gave me regarding charms has been implemented in v1.9.0.