5e-bits/5e-database

Improvement - Extract Magic Item data from Description

mjl757 opened this issue ยท 22 comments

There is data in the description field of a magic items that would be useful to extract out into their own fields for better access.
The first item in the description array holds the item type, as well as the the rarity (or rarities in some instances). So my proposal would be to add a couple fields to the magic item.

First one would be an object named magic_item_category:

{
  "name":  __,
  "desc": __
}

And the second one would be an array named rarity:

[
  {
    "name": __,
     "desc":  __
  }
]

Example:

{
  "index": "ammunition",
  "name": "Ammunition, +1, +2, or +3",
  "equipment_category": {
    "index": "ammunition",
    "name": "Ammunition",
    "url": "/api/equipment-categories/ammunition"
  },
  "magic_item_category": {
    "name": "Weapon",
    "desc": "any ammunition"
  },
  "rarity": [
    {
      "name": "uncommon",
      "desc": "+1"
    },
    {
      "name": "rare",
      "desc": "+2"
    },
    {
      "name": "very rare",
      "desc": "+3"
    }
  ],
  "desc": [
    "Weapon (any ammunition), uncommon (+1), rare (+2), or very rare (+3)",
    "You have a bonus to attack and damage rolls made with this piece of magic ammunition. The bonus is determined by the rarity of the ammunition. Once it hits a target, the ammunition is no longer magical."
  ],
  "url": "/api/magic-items/ammunition"
}

Certainly interested in having a discussion on these purposed changes and seeing what we can work out.

One possible issue see with it is that the category isn't quite in line with other category fields, in that it's not indexable. with it's own table and everything. So I could see us making that more inline with gear and equipment categories then adding a third field to magic_items category_description which would be the description field in the category.

So the above example would become something like this:

{
 ...
  "magic_item_category": {
      "index": "weapon
      "name": "Weapon",
     "url": "/api/magic-item-categories/weapon"
    },
  "magic_item_category_desc": "any ammunition", 
  "rarity": [
    {
      "name": "uncommon",
      "desc": "+1"
    },
    {
      "name": "rare",
      "desc": "+2"
    },
    {
      "name": "very rare",
      "desc": "+3"
    }
  ],
...
}

It's funny that you put Ammunition, +1, +2, or +3 as an example. What are your thoughts on splitting Ammunition, Armor, and Weapon into 3 separate entries each? As they are the outliers compared to the rest of the items.

It's funny that you put Ammunition, +1, +2, or +3 as an example. What are your thoughts on splitting Ammunition, Armor, and Weapon into 3 separate entries each? As they are the outliers compared to the rest of the items.

Honestly that is what I would prefer to do. Also split Crystal Ball up into 4 separate items:

Crystal Ball (Very Rare)
Crystal Ball of Mind Reading (Legendary)
Crystal Ball of Telepathy (Legendary)
Crystal Ball of True Seeing (Legendary)

But I figured a change like that would require a whole new Magic-Items Table since that would probably cause issues with anyone currently the magicItems from this API. If that is something you're open to though I think that would 100% be the best option

I'm 100% open to it. Magic Items is solidly in Beta.

I just haven't had the energy to work on it since it was initially put in.

Honestly I'm really happy to hear you say that. That'll make things so much easier in the project I'm working on XD.

If we're open to the more involved changes I was thinking something closer to this.

{
  "index": "ammunition-1",
  "name": "Ammunition +1",
  "equipment_category": {
    "index": "ammunition",
    "name": "Ammunition",
    "url": "/api/equipment-categories/ammunition"
  },
 "magic_item_category": {
      "index": "weapon",
      "name": "Weapon",
      "url": "/api/magic-item-categories/weapon"
    },
  "magic_item_category_desc": "any ammunition", 
  "rarity": {
      "index": "uncommon"
      "name": "Uncommon"
      "url": "/api/magic-item-rarity/uncommon"
  },
  "desc": [
    "You have a bonus to attack and damage rolls made with this piece of magic ammunition. The bonus is determined by the rarity of the ammunition. Once it hits a target, the ammunition is no longer magical."
  ],
  "url": "/api/magic-items/ammunition-1"
}
{
  "index": "ammunition-2",
  "name": "Ammunition +2",
  "equipment_category": {
    "index": "ammunition",
    "name": "Ammunition",
    "url": "/api/equipment-categories/ammunition"
  },
 "magic_item_category": {
      "index": "weapon",
      "name": "Weapon",
      "url": "/api/magic-item-categories/weapon"
    },
  "magic_item_category_desc": "any ammunition", 
  "rarity": {
      "index": "rare"
      "name": "Rare"
      "url": "/api/magic-item-rarity/rare"
  },
  "desc": [
    "You have a bonus to attack and damage rolls made with this piece of magic ammunition. The bonus is determined by the rarity of the ammunition. Once it hits a target, the ammunition is no longer magical."
  ],
  "url": "/api/magic-items/ammunition-2"
}

I think the magic item categories exist in equipment categories for now.

Any update on this? Separating out the rarity would really help with search filters.

I don't think anyone has actually taken in this work, but if you want to take a crack at it, please feel free. ๐Ÿ˜Š

For the record, the full list of items that would need to be subdivided is as follows:

  • Ammunition, +1, +2, or +3 (uncommon/rare/very rare)
  • Armor, +1, +2, or +3 (rare/very rare/legendary)
  • Belt of Giant Strength (rare/very rare/legendary)
  • Crystal Ball (very rare/legendary)
  • Figurine of Wondrous Power (uncommon/rare/very rare)
  • Potion of Giant Strength (uncommon/rare/very rare/legendary)
  • Horn of Valhalla (rare/very rare/legendary)
  • Potion of Healing (common/uncommon/rare/very rare)
  • Spell Scroll (common/uncommon/rare/very rare/legendary)
  • Wand of the War Mage (uncommon/rare/very rare)
  • Weapon, +1, +2, or +3 (uncommon/rare/very rare)

Other question: do we also subdivide grouped items with the same rarity? Off the top of my head, Bag of Tricks has Gray, Rust, and Tan variants of the same rarity, and Deck of Many Things arguably comes in 13- and 22-card variants.

@MikkelPaulson That's an interesting question. I'm wondering what that would look like and if we'd split the description up between them, which might not be ideal?

Took an attempt at this in #455. I had originally tried keeping the original item and then creating variants for items, but ran into some things that didn't feel right. The Potion of Healing for example has variants, but Potion of Healing is the exact name of one of the variants. I also wasn't sure if the item description should be updated to match the variant or not. I ended up going back to the original suggestion with rarity as an array, but I have my original work stashed that I could finish out. If we do end up wanting to split out, there's some questions that need to be answered

  1. Do we want the original item listed yet (with a "Varies" rarity value)? If we removed that, it would be a breaking change to the API and I'm not sure what the breaking change policy is (or if there is one).
  2. Do we want to update the item description to match the variant? In some cases this was a lot of text changes. Does the SRD allow that?
  3. Do we want to split out items of the same rarity, but have variants (Bag of Tricks).
  4. How are variants named? Is it Belt of Hill Giant Stretch or Belt of Giant Strength (Hill)? Bag of Tricks, Gray or Gray Bag of Tricks?

Those are some really good questions and I'll have to think on them.

  1. Do we want the original item listed yet (with a "Varies" rarity value)? If we removed that, it would be a breaking change to the API and I'm not sure what the breaking change policy is (or if there is one).

My gut reaction is to remove it. And while it is sort of a breaking change, Magic Items are still in Beta. Also, we have release versions now.

However, out of curiosity, I looked up how D&D Beyond handles it and they have both the main overarching item and the various versions of items. In which case, using Varies makes sense. If we go this path, the main magic item should have a way to link to the sub magic items.

  1. Do we want to update the item description to match the variant? In some cases this was a lot of text changes. Does the SRD allow that?

Hmm. I mean we could alter the text but that might be slightly weird. It might make more sense to keep the text the same even if we're only referring to one of the items. The decision isn't a one way door and we can always revisit it. We do something similar with the Dragonborn Breath Weapon.

Thinking about this more, it might make sense to adjust the text for the sub items if we're going the route of keeping the original item.

  1. Do we want to split out items of the same rarity, but have variants (Bag of Tricks).

Yes. I think so. They are distinct items that have different properties. If we think about how a user my utilize this data, they might want to have a random treasure roller for Rare Magic Items.

  1. How are variants named? Is it Belt of Hill Giant Stretch or Belt of Giant Strength (Hill)? Bag of Tricks, Gray or Gray Bag of Tricks?

I think for that example Belt of Hill Giant Strength makes more sense. Also Gray Bag of Tricks.

Thanks for the feedback! I'll make some changes to address this sometime this week. Here's my plan on what to do:

  • Keep the original items and create a "variants" array. These items will have a "Varies" rarity value
  • On the variants, update the text to match the variant description
  • Split out variants with the same rarity
  • Give the variants unique names like "Gray Bag of Tricks"
{
    "index": "ammunition",
    "name": "Ammunition, +1, +2, or +3",
    "equipment_category": {
      "index": "ammunition",
      "name": "Ammunition",
      "url": "/api/equipment-categories/ammunition"
    },
    "rarity": {
      "name": "Varies"
    },
    "variants": [
      {
        "index": "ammunition-1",
        "name": "Ammunition, +1",
        "url": "/api/magic-items/ammunition-1"
      },
      // more variants here
    ],
    "desc": [
      "Weapon (any ammunition), uncommon (+1), rare (+2), or very rare (+3)",
      "You have a bonus to attack and damage rolls made with this piece of magic ammunition. The bonus is determined by the rarity of the ammunition. Once it hits a target, the ammunition is no longer magical."
    ],
    "url": "/api/magic-items/ammunition"
  },
  {
    "index": "ammunition-1",
    "name": "Ammunition, +1",
    "equipment_category": {
      "index": "ammunition",
      "name": "Ammunition",
      "url": "/api/equipment-categories/ammunition"
    },
    "rarity": {
      "name": "Uncommon"
    },
    "variants": [],
    "desc": [
      "Weapon (any ammunition), uncommon",
      "You have a +1 bonus to attack and damage rolls made with this piece of magic ammunition. Once it hits a target, the ammunition is no longer magical."
    ],
    "url": "/api/magic-items/ammunition-1"
  },

Sounds great! Thank you for doing the legwork on this one!

rarity and variants are ready for review in #455

Once that gets merged, I'm going to work on adding attunement data

I think that is a really good solution. I like that it keeps the original description from the source material, for the original varied item, while letting you get a more detail description and rarity from the variant item.

Is there any concern with having the variants be in the same list as the parents they're created from. I could see there being some confusion with how to handle querying the magic items table if your list pulls down "Ammunition, +1, +2, or +3", and "Ammunition, +1", "Ammunition, +2", and "Ammunition, +3"

I just added that as a comment on the PR, since that might be a more appropriate place for the convo

@mjl757 What are you hoping to get out of magic_item_category? How is it different from equipment_category?

@bagelbits I'll be honest, I wrote this a year ago when I was on vacation in Mexico, and I'm not sure what I was going for there. I clearly intended there to be some difference, but what it is? I can't say. I think this issue can be considered closed with the variant item changes.