theBowja / genshin-db

npm package with searching functions for Genshin Impact data of all in-game languages. Data parsed/organized directly from GenshinData repo.
MIT License
363 stars 69 forks source link

add your own aliases #37

Closed theBowja closed 2 years ago

theBowja commented 3 years ago

Add a way to register new aliases to data.

For example if I wanted the query 'Harem King' to return Aether character data.

genshindb('Harem King', { matchAliases: true });

NepPure commented 3 years ago

Is this feature still under development?

theBowja commented 3 years ago

I have not started on this yet. But I do plan on adding it eventually. Possibly within a month.

NepPure commented 3 years ago

Thanks for answering.

https://github.com/theBowja/genshin-db/blob/c4faa909f506b7d556a20c3795c593d118551a4f/src/data/image/characters.json#L10-L19

Are these image resources maintained manually? For example, "cover1", I haven't seen it in the game.

theBowja commented 3 years ago

I mainly manually update the links.

image, card, and portrait are wikia image links and I no longer update them. They can be considered deprecated or unreliable until I can figure out a way to automatically grab them from the wikia.

icon and sideicon property will always have links generated but availability of the images depend on hoyolab. Generally they have these icon images for new characters soon after they are live.

cover1 and cover2 I have a script that grabs them straight from the official website. https://genshin.mihoyo.com/en/character/mondstadt?char=0

hoyolab-avatar I grab them from hoyolab's profile icon list. Not every character will have this image.

theBowja commented 3 years ago

If you know any image hosters that are reliable and easy to access, please let me know and I might add them.

NepPure commented 3 years ago

Thank you very much! Does the item icon come directly from the game unpacking data?

theBowja commented 3 years ago

"UI_AvatarIcon_Albedo" and "UI_AvatarIcon_Side_Albedo" comes straight from the game unpacking data.

NepPure commented 3 years ago

The data is very easy to use, I tried to make this. https://github.com/NepPure/genshin-card

image

GitHub Pages:

https://genshin-card.neptunia.vip/cards/views/character.html?name=%E9%9B%B7%E7%94%B5%E5%B0%86%E5%86%9B

One problem is that no weapon images similar to "cover1" have been found.

I seem to have seen them somewhere, but I forgot. I wonder if you have any impression.

Thank you very much again!

theBowja commented 3 years ago

Wow that looks really awesome. The images might load kinda slow. I recommend downscaling them or find a CDN that can automatically transform them from url or whatever.

All the weapon images similar to "cover1" are called UI_Gacha_EquipIcon_${imagename}

I've dumped every image and put them on mediafire. It's 1GB download.

Alternatively you can access them like: https://res.cloudinary.com/genshin/image/upload/2.1/UI_Gacha_EquipIcon_Claymore_Lapis.png

I haven't linked the urls in my database yet. You can still map the file names in my database yourself tho:

let dbimages= genshindb.weapons("Lost Prayers").images;
let imagename = dbimages.icon.slice(dbimages.icon.indexOf("UI_EquipIcon")+13); //grabs "Catalyst_Fourwinds.png"
console.log(`https://res.cloudinary.com/genshin/image/upload/2.1/UI_Gacha_EquipIcon_${imagename}`);

I only managed to find these images recently. There's still a lot of work to do to add them to genshin-db. Let me know if you need anything else.

NepPure commented 3 years ago

I plan to use GitHub CI to generate all static images of characters and weapons.

https://github.com/NepPure/genshin-card/tree/main/cards/output

ing...: https://github.com/NepPure/genshin-card/blob/main/cards.js

The free cloudflare and GitHub Pages should be enough. 😁

I added a global CDN to my resource domain, and it should be faster now.

Thank you so much for these resources, they helped me a lot!

NepPure commented 3 years ago

Hi, one more question 5)5NH8})JYI568}K3EGBW)Y

image

How to match this index number to item json info?

theBowja commented 3 years ago

added image names to materials d5f5ee3d8737d005933c4021295011cf7e7f2fc2

genshindb.materials('handguard').images.nameicon
// UI_ItemIcon_112044

let me know if there's any missing materials you want me to add

theBowja commented 2 years ago

v3.10.1