All Projects → theBowja → genshin-db

theBowja / genshin-db

Licence: MIT License
npm package with searching API for Genshin Impact data of all in-game languages. Data parsed/organized directly from GenshinData repo.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to genshin-db

genshin-audio-exporter
Export audio files from Genshin Impact game data into different audio formats.
Stars: ✭ 83 (-44.67%)
Mutual labels:  genshin, genshin-impact, genshinimpact
Snap.Genshin
你想要的原神全家桶
Stars: ✭ 1,924 (+1182.67%)
Mutual labels:  genshin, genshin-impact, genshinimpact
genshin.py
Modern API wrapper for Genshin Impact & Honkai Impact 3rd built on asyncio and pydantic. 原神 崩坏3
Stars: ✭ 199 (+32.67%)
Mutual labels:  genshin, genshin-impact
genshin-schedule
🕑 Genshin farming scheduler
Stars: ✭ 74 (-50.67%)
Mutual labels:  genshin, genshin-impact
Hilipedia
丘丘语语料库与词典 Hilichurlian Corpus and Dictionary
Stars: ✭ 33 (-78%)
Mutual labels:  genshin, genshin-impact
DoMiSo-genshin
Genshin impact Lyre Automatic player
Stars: ✭ 76 (-49.33%)
Mutual labels:  genshin, genshin-impact
GenshinImpact-AHK-flex
AHK script for Genshin Impact
Stars: ✭ 80 (-46.67%)
Mutual labels:  genshin, genshin-impact
GenshinImpact-Generator
Account generator for Genshin Impact
Stars: ✭ 38 (-74.67%)
Mutual labels:  genshin-impact, genshinimpact
GenshinPlayerQuery
根据原神uid查询玩家信息(基础数据、角色&装备、深境螺旋战绩等)
Stars: ✭ 261 (+74%)
Mutual labels:  genshin, genshin-impact
AutoMihoyoBBS
米游社自动签到,支持:崩坏二、崩坏三、原神,米游币自动获取
Stars: ✭ 528 (+252%)
Mutual labels:  genshin, genshin-impact
Genshin-fishing
Genshin auto fishing
Stars: ✭ 237 (+58%)
Mutual labels:  genshin, genshin-impact
DodocoTales
A banner-oriented Genshin Impact wish logs exporter & explorer
Stars: ✭ 19 (-87.33%)
Mutual labels:  genshin-impact, genshinimpact
Inventory Kamera
Scans Genshin Impact characters, artifacts, and weapons from the game window into a JSON file.
Stars: ✭ 348 (+132%)
Mutual labels:  genshin, genshin-impact
GenShin-LauncherDIY
[原神启动器Plus] lightweight globalized Genshin Impact launcher. Support arbitrarily resolution ratio, account switching, client convertion, FPS unlocking and more!
Stars: ✭ 758 (+405.33%)
Mutual labels:  genshin, genshin-impact
Adachi-BOT
一个在 QQ 中运行的原神助手
Stars: ✭ 185 (+23.33%)
Mutual labels:  genshin, genshin-impact
cocogoat
A toolbox for Genshin Impact 100% running in browser. 纯网页端的原神工具箱,保证每一行代码都是熬夜加班打造。
Stars: ✭ 571 (+280.67%)
Mutual labels:  genshin, genshin-impact
Teyvat.moe
A flexible, community-driven interactive website for Genshin Impact.
Stars: ✭ 137 (-8.67%)
Mutual labels:  genshin, genshin-impact
GenshinImpact
This repo contains a script meant to ease and help intel players with setting up their machine to be able to play this game.
Stars: ✭ 27 (-82%)
Mutual labels:  genshin, genshin-impact
genshinstats
A dead python library that can get the stats of Genshin Impact players using Mihoyo's API.
Stars: ✭ 217 (+44.67%)
Mutual labels:  genshin, genshin-impact
genshin-wishes-i18n
A contribution-driven project to translate Genshin Wishes in many languages.
Stars: ✭ 25 (-83.33%)
Mutual labels:  genshin-impact

genshin-db

npm npm bundle size

Genshin Impact JSON data with a robust searching API! Updated to version 2.6. Sources from the fandom wiki and GenshinData repo.


Flexibly search and get the information of characters, talents, constellations, weapons, weapon material, talent material, artifacts, food recipes, domains, etc.

All in-game languages are supported for query and result.

Install Node v12 or higher. Install npm. Then install this package into your project with:

npm install genshin-db

Start with:

const genshindb = require('genshin-db');

REFER TO EXAMPLES.md since the readme below isn't detailed.

Every query input string will be autocompleted to match available values. This means doing something like genshin.characters('amb') will give the same results as genshin.characters('amber'). If there are no results, then undefined will be returned.

Data format may change frequently. If you need to know the data format for some specific version of this library, you can go to the github and switch to the tag version you're on. Then go into the data folder and look at the data to find the format. Don't look into the template folder since it isn't up-to-date.

If you need help or have questions, you can talk to me in my discord.

Table of Contents

Options

genshindb.setOptions(opts)

The following are the default options that the library starts off with. If you want to change it, then call genshindb.setOptions.

{
    dumpResult: false, // The query result will return an object with the properties: query, folder, match, options, filename, result.
    matchAltNames: true, // Allows the matching of alternate or custom names.
    matchAliases: false, // Allows the matching of aliases. These are searchable fields that returns the data object the query matched in.
    matchCategories: false, // Allows the matching of categories. If true, then returns an array if it matches.
    verboseCategories: false, // Used if a category is matched. If true, then replaces each string name in the array with the data object instead.
    queryLanguages: ["English"], // Array of languages that your query will be searched in.
    resultLanguage: "English" // Output language that you want your results to be in.
}

If matchCategories is set to true, then the query may match a category like genshindb.characters('Geo'). An array of string names will be returned. If verboseCategories is set to true, then an array of objects will be returned instead.

Supported languages options are: ChineseSimplified, ChineseTraditional, English, French, German, Indonesian, Japanese, Korean, Portuguese, Russian, Spanish, Thai, Vietnamese.

genshindb.getOptions()

Query Functions

genshindb.characters(query[, opts])

Returns the profile info for characters.

Possible query inputs include: character names, character titles, constellation names, birthday months, elements, substats, weapon types, genders, regions, rarities, and 'name' for the list of all characters. The result also includes a function to calculate the stats of the character at each level.

Check out categories.json file to see choices for each category.
Check out examples.md to see example inputs and outputs for this function.

genshindb.talents(query[, opts])

Returns the combat skills and passive skills for characters.

Possible query inputs include: character names, upgrade materials.

Check out categories.json file to see choices for each category.
Check out examples.md to see example inputs and outputs for this function.

genshindb.constellations(query[, opts])

Returns the constellation information for characters.

Possible query inputs include: character names.

Check out categories.json file to see choices for each category.
Check out examples.md to see example inputs and outputs for this function.

genshindb.weapons(query[, opts])

Possible inputs for query parameter are:

  • all weapon names
  • all weapon types
  • all rarities
  • all weapon ascension material types
  • "names"

The result also includes a function to calculate the stats of the weapon at each level.

Check out categories.json file to see choices for each category.
Check out examples.md to see example inputs and outputs for this function.

genshindb.weaponmaterialtypes(query[, opts])

Possible inputs for query parameter are:

  • all weapon ascension material names
  • all days of the week
  • all regions
  • all domains of forgery
  • "names"

Check out categories.json file to see choices for each category.
Check out examples.md to see example inputs and outputs for this function.

genshindb.talentmaterialtypes(query[, opts])

Possible inputs for query parameter are:

  • all talent book names
  • all days of the week
  • all regions
  • all domains of mastery
  • "names"

Check out categories.json file to see choices for each category.
Check out examples.md to see example inputs and outputs for this function.

genshindb.materials(query[, opts])

  • rarity, type, 'WOOD', ingredient, specialty liyue, domains, days of week, talent books, etc.
  • "names"

Check out categories.json file to see choices for each category.
Check out examples.md to see example inputs and outputs for this function.

genshindb.artifacts(query[, opts])

Possible inputs for query parameter are:

  • all artifact set names
  • all rarities
  • "names"

Check out categories.json file to see choices for each category.
Check out examples.md to see example inputs and outputs for this function.

genshindb.foods(query[, opts])

Possible inputs for query parameter are:

  • all recipe names
  • all rarities
  • all recipe types
  • all ingredients
  • all buffs
  • all characters with specialty dishes

Check out categories.json file to see choices for each category.
Check out examples.md to see example inputs and outputs for this function.

genshindb.domains(query[, opts])

Possible inputs for query parameter are:

  • all domain names
  • domain entrance names
  • domain types
  • recommended elements
  • days of week

Check out examples.md to see example inputs and outputs for this function.

genshindb.enemies(query[, opts])

Possible inputs for query parameter are:

  • all enemy names
  • enemy type: "COMMON", "ELITE", "BOSS"
  • enemy category (found in in-game archive)

Check out examples.md to see example inputs and outputs for this function.

genshindb.elements(query[, opts])

Input the name of an element

genshindb.rarity(query[, opts])

dunno about this

Adding Custom Names

If you want to add your own search string to return a specific search data, then you can! For example, the following code will allow you to search "Harem King" to retrieve the character data for Aether.

genshindb.addAltName(genshindb.Languages.English, genshindb.Folders.characters, "Harem King", "Aether");
genshindb.characters("harem"); // returns data for Aether

These do NOT persist if you restart. If you need these to persist, come into my discord and let's talk about it. :)

genshindb.addAltName(language, folder, altname, query)

Adds the altname as a custom name to reach query inside the language/folder combination.

The enum for available languages is at genshindb.Languages. Or look inside language.js
The enum for available folders is at genshindb.Folders. Or look inside folder.js

altname is the custom name you want to add. Autocomplete will be available for this.
query is the name of the data you want to attach your custom name too. It must be in the language you specified previously.

Returns true or false depending on if your altname was successfully added or not.

genshindb.removeAltNames(language, folder, altname)

Removes the altname from a language/folder combination.

Returns true or false depending on if your altname was successfully deleted or not.

genshindb.setAltNameLimits(limit)

limit is an object with the following type:

{
    maxLength?: number, // default is 100
    maxCount?: number // default is 1000
}

maxLength: You can set the max character length limit for altnames to be added. If your character limit is 5, then altname "Drunk Bard" will not be added when you try to add it.
maxCount: You can also set the max number of custom names allowed. This is to prevent accidents where you run out of memory.

Notes

Is using JSON as a database a good idea? Probably not. Is MIT License the correct license? Probably not.

Contributing

The best way to contribute to this project is to write up feature requests in GitHub issues. Also join my discord show me what you've built so I know this is useful to people :)


My ambition for this library is to include most of the relevant genshin data so it can be downloaded and used easily with any project. Credits to GenshinData repo for the datamined files.

If you just want to take the data and use it yourself, you are welcome to do so. All the data is in src/data. Minified data is generated in src/min. You can use the index in src/data/index to map between the data name and file name. The stats for character and weapon levels are calculated in src/getdata.js. If you need any help feel free to write an issue or jump into my discord and talk to me directly. I would appreciate it a lot if people showed me the projects they've done with the help of the parsed data.

Typescript

I made an index.d.ts file. It probably works.

Here's a bunch of examples for typing:

characters("names", { matchCategories: true }); // string[]
characters("names", { matchCategories: true, verboseCategories: true }); // Character[]

characters("names"); // Character | undefined
characters("names", { matchCategories: false }); // Character | undefined
characters("foobar"); // Character | undefined
characters("foobar", { matchCategories: false }); // Character | undefined
characters("foobar", { verboseCategories: true }); // Character | undefined

characters("foobar", { matchCategories: true }); // Character | string[] | undefined
characters("foobar", { matchCategories: true, verboseCategories: true }); // Character | Character[] | undefined

Please write up an issue if something doesn't work.

Distributions for Web/Node

If you don't want to use the npm package, then you can take a look at the prebuilt distributions that can be used easily from web or in your Node project. Read the documentation about it here.

Webpack

If for some reason you want to customize genshin-db into your own webpack dist.

First you'll need to clone this repo.

If you want to build a webpack just do npm run build and it'll appear in the dist/genshindb.js. Then you can call all the query functions from above using genshindb as the variable. Or you can change the options in webpack.config.js to better fit how you want to use it.

The distribution will be quite large. More than 15mb. If you wish to reduce the size of this, then you can remove the data for languages you don't need. Simply append a space-separated list of languages that you wish to ONLY include in the webpack.

For example: npm run build english will produce a distribution in the dist folder with only the English genshin data.

More examples: npm run build english chinesesimplified korean japanese, npm run build french german

Available language names can be found in src/language.js file. Or you can scroll up to the setOptions section in this readme.

If you want to specify only specific folders, then you can as well.

For example: run build english characters weapons will produce a distribution with only English characters and weapons data.

Available folder names can be found in src/folder.js file.

Time and Space

Updated 9/8/2021.

genshin-db is around 18mb. If you're serving content, please do not send the entire package to the client. A web page receiving the entire webpack will take some time to load, which does not provide for the best user experience.

My query functions aren't the fastest thing in existence. But it is fast enough that it doesn't really matter. Unless you're running the code on a real potato.

console.time();
for(let i = 0; i < 5000; i++) {
    tmp = genshindb.material('names', { matchCategories:true, verboseCategories:true, queryLanguages:['eng', 'jp', 'ko']} );
}
console.timeEnd();

// default: 1.043s

You're likely not gonna have a problem unless you're handling thousands of queries per second with more than one query language enabled. Make an issue if you're actually having problems.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].