Closed PierreAndreis closed 6 years ago
@PierreAndreis check out e491b60, let me know if this works. I haven't played with the API lately so I'm not sure if there are anymore bad item names. Shoot them here if so and i'll add another check before releasing a new version.
It can be on these format:
*1000_Item_HalcyonPotion*
*Item_Pulseweave*
Item_RooksDecree
and sometimes it needs some mapping because they are wrong names:
{
"serverName": "Crystal3",
"name": "Shatterglass"
}
What I think we should do instead:
Keep the current mappings, and check for matches there first. If there is a match, we use the name
and return it.
If there are no matches, then we check if the format is compatible to /^(.*)_(.*)\**/gm
and then extract the second group. We should then add the spaces between the two words.
Reason why the last * is a 0+ quantifier is because sometimes there are no asterisks as shown in Item_RooksDecree
What do you think?
In that case, we could probably just get away with something like this (.*)Item_(.*?)
, then clean up characters thereafter. See changes in 885369e
Recently, most if the item names are coming in same pattern:
*Item_{Camel Case Item Name}*
What we are doing right now
For every new item, we need to update the item mapping with the correct name and server name. This add a need for a new minor release of this package on every vainglory update that introduces a new item to the game.
What we should do
Keep track of dirty mappings, and if there is no map we should check if we can get the name translated using a regex. That's the same way we have been handling heroes name.
This will reduce the maintenance need for every update that introduces new item