Skip to content

Commit

Permalink
Update enka import to 3.2 (#1075)
Browse files Browse the repository at this point in the history
* progress

* trying to reconcile main branchs

* created script to get enka files

* added cyno and nilou

* cleanup
  • Loading branch information
ChinPTeo authored Nov 5, 2022
1 parent a01cbc9 commit 84e5f0b
Show file tree
Hide file tree
Showing 7 changed files with 2,755 additions and 2,521 deletions.
1 change: 1 addition & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"source": "src/index.html",
"scripts": {
"start": "parcel src/index.html",
"enka": "node ./src/Components/Enka/GenshinData/DownloadFromEnkaScript.js",
"build": "parcel build src/index.html --dist-dir build"
},
"devDependencies": {
Expand Down
10 changes: 10 additions & 0 deletions app/src/Components/Character/characters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@ export const characterKeyToICharacter: { [key: string]: ICharacter } = {
element: 'dendro',
weapon_type: 'catalyst',
},
cyno: {
key: 'cyno',
element: 'electro',
weapon_type: 'polearm',
},
nilou: {
key: 'nilou',
element: 'hydro',
weapon_type: 'sword',
},
};

export const items: ICharacter[] = Object.keys(characterKeyToICharacter).map(
Expand Down
32 changes: 32 additions & 0 deletions app/src/Components/Enka/GenshinData/DownloadFromEnkaScript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const fs = require('fs');
const https = require('https');
let url = 'https://raw.githubusercontent.com/EnkaNetwork/API-docs/master/store/characters.json';
https.get(url,(res) => {
// Image will be stored at this path
const path = `./src/Components/Enka/GenshinData/EnkaCharacterMap.json`;
const filePath = fs.createWriteStream(path);
res.pipe(filePath);
filePath.on('finish',() => {
filePath.close();
console.log('Download Completed');
})
})

url = 'https://raw.githubusercontent.com/EnkaNetwork/API-docs/master/store/loc.json'
https.get(url,(res) => {
// Image will be stored at this path
const path = `./src/Components/Enka/GenshinData/EnkaTextMapEN.json`;
// use key "en" to extract english json
var str = ''
res.on('data', (data) => {
str += data
})
res.on('end', async function() {
var json = JSON.parse(str)
var en = json['en']
fs.writeFileSync(
'./src/Components/Enka/GenshinData/EnkaTextMapEN.json',
JSON.stringify({"en":en})
);
})
})
Loading

0 comments on commit 84e5f0b

Please sign in to comment.