-
Notifications
You must be signed in to change notification settings - Fork 66
Description
Describe the bug
Many items have missing data due to an incorrect categorisation by the parser.mjs
NodeJS Version
lts
npm Version
lts
@wfcd/items Version
v1.1272.133
Access Method
github download
What happened?
I noticed a major data regression caused by an incorrect categorisation in parser.mjs
I was playing around with arcanes when I noticed, some had the attribute "rarity" missing.
On the journey to find the issue, I found an incorrect categorisation of items, but I cannot tell how far this goes on.
Here's an explanation of the issue, on the example of arcanes:
This function adds the data to an item, with a given category:
warframe-items/build/parser.mjs
Line 181 in ec880ff
| filter(original, category, data) { |
In this line, the category set in the item can change:
warframe-items/build/parser.mjs
Line 193 in ec880ff
| this.addCategory(result, category); |
But the original given category is NOT reassigned to the new one
Some functions afterwards are also passed a category, in this case the ORIGINAL one:
warframe-items/build/parser.mjs
Lines 198 to 201 in ec880ff
| this.addAdditionalWikiaData(result, category, data.wikia); | |
| this.addIsPrime(result); | |
| this.addVaultData(result, category, data.wikia); | |
| this.addResistanceData(result, category); |
In case of this function, it is in first place missing the "arcane" property in the first line (which is another issue I'll create afterwards), but it is also comparing with the ORIGINAL category:
warframe-items/build/parser.mjs
Line 907 in ec880ff
| addAdditionalWikiaData(item, category, wikiaData) { |
This function is essential:
warframe-items/build/parser.mjs
Line 626 in ec880ff
| addCategory(item, category) { |
It changes "RelicArcane" into the correct category:
warframe-items/build/parser.mjs
Lines 655 to 657 in ec880ff
| case 'RelicArcane': | |
| if (item.type !== 'Relic') item.category = 'Arcanes'; | |
| else item.category = 'Relics'; |
And also the category of "Upgrades" and "Warframes" is changed:
warframe-items/build/parser.mjs
Lines 665 to 674 in ec880ff
| case 'Upgrades': | |
| item.category = 'Mods'; | |
| if (item.compatName !== 'Warframe' && item.type === 'Warframe Mod') item.isAugment = true; | |
| break; | |
| case 'Warframes': | |
| if (item.isArchwing) item.category = 'Archwing'; | |
| else item.category = 'Warframes'; | |
| item.isArchwing = undefined; | |
| break; |
This also results to "upgrades" appearing falsely in this list, next to "mods":
warframe-items/build/parser.mjs
Line 908 in ec880ff
| if (!['weapons', 'warframes', 'mods', 'upgrades', 'sentinels'].includes(category.toLowerCase())) return; |
This part is "fixing" the issue I described above for at least some items, but I don't think this is the correct solution here, scince the issue starts way before:
warframe-items/build/parser.mjs
Lines 928 to 931 in ec880ff
| let wikiCategory = category.toLowerCase(); | |
| if (category === 'Upgrades') wikiCategory = 'mods'; | |
| if (item.category === 'Archwing') wikiCategory = 'archwings'; | |
| if (category === 'Sentinels') wikiCategory = 'companions'; |