WFCD / warframe-items

📘 Get all Warframe items directly from Warframe's API. No more messy wikia scraping.
MIT License
279 stars 53 forks source link

:bug: Wikia weapon damage type and values #163

Closed larvanitis closed 3 years ago

larvanitis commented 3 years ago

Describe the bug Weapon damage types are inconsistent. Some are numbers (eg. 12.34), some are strings (eg. "12.34") and some are strings including and element type (eg. "72.0 radiation").

According to my research:

  1. These are wikia sourced data.
  2. damage is supposed to be the sum of all damageTypes.
  3. Number and "just string" formatted values match.
  4. "String with element" formatted values are a parsing error, since they are always equal to the last element of damageTypes.

To Reproduce Steps to reproduce the behavior:

  1. Open https://raw.githubusercontent.com/WFCD/warframe-items/development/data/json/Melee.json
  2. Find 'Tatsu'
  3. See error
    "damage": "72.0 radiation",
    "damageTypes": {
      "impact": 20,
      "slash": 68,
      "puncture": 54,
      "radiation": 72
    },

You can also find all those entries with

const data = require('[...]/All.json');
const oops = data.filter(x => typeof x.damage === 'string' && !/^\d+(\.\d+)?$/.test(x.damage));

Expected behavior Damage type to be always number and without parsing errors.

TobiTenno commented 3 years ago

damage has worked how it does at present for more than 2 years, i'm not planning on making such a drastic formatting change.