Skip to content

Commit

Permalink
feat: albedo done
Browse files Browse the repository at this point in the history
  • Loading branch information
LudovicMalot committed Jan 20, 2024
1 parent 7fe0afb commit 1f4b3eb
Show file tree
Hide file tree
Showing 109 changed files with 596 additions and 951 deletions.
90 changes: 35 additions & 55 deletions data/DE/Character/Albedo.json

Large diffs are not rendered by default.

90 changes: 35 additions & 55 deletions data/EN/Character/albedo.json

Large diffs are not rendered by default.

90 changes: 35 additions & 55 deletions data/ES/Character/Albedo.json

Large diffs are not rendered by default.

90 changes: 35 additions & 55 deletions data/FR/Character/Albedo.json

Large diffs are not rendered by default.

90 changes: 35 additions & 55 deletions data/ID/Character/Albedo.json

Large diffs are not rendered by default.

90 changes: 35 additions & 55 deletions data/IT/Character/Albedo.json

Large diffs are not rendered by default.

90 changes: 35 additions & 55 deletions data/JP/Character/Albedo.json

Large diffs are not rendered by default.

90 changes: 35 additions & 55 deletions data/KO/Character/Albedo.json

Large diffs are not rendered by default.

90 changes: 35 additions & 55 deletions data/PT/Character/Albedo.json

Large diffs are not rendered by default.

90 changes: 35 additions & 55 deletions data/RU/Character/Albedo.json

Large diffs are not rendered by default.

90 changes: 35 additions & 55 deletions data/TH/Character/Albedo.json

Large diffs are not rendered by default.

90 changes: 35 additions & 55 deletions data/TR/Character/Albedo.json

Large diffs are not rendered by default.

90 changes: 35 additions & 55 deletions data/VI/Character/Albedo.json

Large diffs are not rendered by default.

90 changes: 35 additions & 55 deletions data/ZH-S/Character/Albedo.json

Large diffs are not rendered by default.

90 changes: 35 additions & 55 deletions data/ZH-T/Character/Albedo.json

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Character/Albedo/face.webp
Binary file not shown.
Binary file added images/Character/Albedo/gachaSplash.webp
Binary file not shown.
Binary file added images/Character/Albedo/gatchaCard.webp
Binary file not shown.
Binary file added images/Character/Albedo/halfFace.webp
Binary file not shown.
Binary file added images/Character/Albedo/icon.webp
Binary file not shown.
Binary file added images/Character/Albedo/profile.webp
Binary file not shown.
Binary file added images/Character/Albedo/sideIcon.webp
Binary file not shown.
Binary file added images/Character/Albedo/weaponStance.webp
Binary file not shown.
Binary file removed images/characters/albedo.png
Binary file not shown.
Binary file removed images/characters/alhaitham.png
Binary file not shown.
Binary file removed images/characters/aloy.png
Binary file not shown.
Binary file removed images/characters/amber.png
Binary file not shown.
Binary file removed images/characters/arataki_itto.png
Binary file not shown.
Binary file removed images/characters/baizhu.png
Binary file not shown.
Binary file removed images/characters/barbara.png
Binary file not shown.
Binary file removed images/characters/beidou.png
Binary file not shown.
Binary file removed images/characters/bennett.png
Binary file not shown.
Binary file removed images/characters/candace.png
Binary file not shown.
Binary file removed images/characters/characters.png
Binary file not shown.
Binary file removed images/characters/charlotte.png
Binary file not shown.
Binary file removed images/characters/chongyun.png
Binary file not shown.
Binary file removed images/characters/collei.png
Binary file not shown.
Binary file removed images/characters/cyno.png
Binary file not shown.
Binary file removed images/characters/dehya.png
Binary file not shown.
Binary file removed images/characters/diluc.png
Binary file not shown.
Binary file removed images/characters/diona.png
Binary file not shown.
Binary file removed images/characters/dori.png
Binary file not shown.
Binary file removed images/characters/eula.png
Binary file not shown.
Binary file removed images/characters/faruzan.png
Binary file not shown.
Binary file removed images/characters/fischl.png
Binary file not shown.
Binary file removed images/characters/freminet.png
Binary file not shown.
Binary file removed images/characters/furina.png
Binary file not shown.
Binary file removed images/characters/ganyu.png
Diff not rendered.
Binary file removed images/characters/gorou.png
Diff not rendered.
Binary file removed images/characters/hu_tao.png
Diff not rendered.
Binary file removed images/characters/jean.png
Diff not rendered.
Binary file removed images/characters/kaedehara_kazuha.png
Diff not rendered.
Binary file removed images/characters/kaeya.png
Diff not rendered.
Binary file removed images/characters/kamisato_ayaka.png
Diff not rendered.
Binary file removed images/characters/kamisato_ayato.png
Diff not rendered.
Binary file removed images/characters/kaveh.png
Diff not rendered.
Binary file removed images/characters/keqing.png
Diff not rendered.
Binary file removed images/characters/kirara.png
Diff not rendered.
Binary file removed images/characters/klee.png
Diff not rendered.
Binary file removed images/characters/kujou_sara.png
Diff not rendered.
Binary file removed images/characters/kuki_shinobu.png
Diff not rendered.
Binary file removed images/characters/layla.png
Diff not rendered.
Binary file removed images/characters/lisa.png
Diff not rendered.
Binary file removed images/characters/lynette.png
Diff not rendered.
Binary file removed images/characters/lyney.png
Diff not rendered.
Binary file removed images/characters/mika.png
Diff not rendered.
Binary file removed images/characters/mona.png
Diff not rendered.
Binary file removed images/characters/nahida.png
Diff not rendered.
Binary file removed images/characters/navia.png
Diff not rendered.
Binary file removed images/characters/neuvillette.png
Diff not rendered.
Binary file removed images/characters/nilou.png
Diff not rendered.
Binary file removed images/characters/ningguang.png
Diff not rendered.
Binary file removed images/characters/noelle.png
Diff not rendered.
Binary file removed images/characters/paimon.png
Diff not rendered.
Binary file removed images/characters/qiqi.png
Diff not rendered.
Binary file removed images/characters/raiden_shogun.png
Diff not rendered.
Binary file removed images/characters/razor.png
Diff not rendered.
Binary file removed images/characters/rosaria.png
Diff not rendered.
Binary file removed images/characters/sangonomiya_kokomi.png
Diff not rendered.
Binary file removed images/characters/sayu.png
Diff not rendered.
Binary file removed images/characters/shenhe.png
Diff not rendered.
Binary file removed images/characters/shikanoin_heizou.png
Diff not rendered.
Binary file removed images/characters/sucrose.png
Diff not rendered.
Binary file removed images/characters/tartaglia.png
Diff not rendered.
Binary file removed images/characters/thoma.png
Diff not rendered.
Binary file removed images/characters/tighnari.png
Diff not rendered.
Binary file removed images/characters/traveler.png
Diff not rendered.
Binary file removed images/characters/traveler_anemo.png
Diff not rendered.
Binary file removed images/characters/traveler_dendro.png
Diff not rendered.
Binary file removed images/characters/traveler_electro.png
Diff not rendered.
Binary file removed images/characters/traveler_geo.png
Diff not rendered.
Binary file removed images/characters/venti.png
Diff not rendered.
Binary file removed images/characters/wanderer.png
Diff not rendered.
Binary file removed images/characters/wriothesley.png
Diff not rendered.
Binary file removed images/characters/xiangling.png
Diff not rendered.
Binary file removed images/characters/xiao.png
Diff not rendered.
Binary file removed images/characters/xingqiu.png
Diff not rendered.
Binary file removed images/characters/xinyan.png
Diff not rendered.
Binary file removed images/characters/yae_miko.png
Diff not rendered.
Binary file removed images/characters/yanfei.png
Diff not rendered.
Binary file removed images/characters/yaoyao.png
Diff not rendered.
Binary file removed images/characters/yelan.png
Diff not rendered.
Binary file removed images/characters/yoimiya.png
Diff not rendered.
Binary file removed images/characters/yun_jin.png
Diff not rendered.
Binary file removed images/characters/zhongli.png
Diff not rendered.
74 changes: 11 additions & 63 deletions schemas/Character.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,7 @@
},
"artifacts": {
"items": {
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
"type": "string"
},
"type": "array"
},
Expand Down Expand Up @@ -225,15 +217,7 @@
},
"featuredBanner": {
"items": {
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
"type": "string"
},
"type": "array"
},
Expand All @@ -249,6 +233,9 @@
"outfits": {
"items": {
"properties": {
"description": {
"type": "string"
},
"id": {
"type": "string"
},
Expand All @@ -260,6 +247,7 @@
}
},
"required": [
"description",
"id",
"name",
"picture"
Expand Down Expand Up @@ -340,26 +328,10 @@
"type": "string"
},
"signatureArtifactSet": {
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
"type": "string"
},
"signatureWeapon": {
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
"type": "string"
},
"skills": {
"items": {
Expand Down Expand Up @@ -410,15 +382,7 @@
"type": "array"
},
"specialDish": {
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
"type": "string"
},
"substat": {
"type": "string"
Expand Down Expand Up @@ -469,15 +433,7 @@
"type": "array"
},
"tcgCharacterCard": {
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
"type": "string"
},
"title": {
"type": "string"
Expand All @@ -487,15 +443,7 @@
},
"weapons": {
"items": {
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
"type": "string"
},
"type": "array"
}
Expand Down
68 changes: 52 additions & 16 deletions temp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,62 @@ const fs = require('fs');
const path = require('path');

const dataDirPath = './data';
const regex = /"_id":\s*\d+,/g;
const charName = 'Albedo'; // Replace with your character's name

function processFile(filePath) {
const data = fs.readFileSync(filePath, 'utf8');
const modifiedData = data.replace(regex, '');
// Define the JSON object with all missing fields
const missingFields = {
artifacts: [
'HuskOfOpulentDreams',
'GoldenTroupe',
], // Populate these fields as needed
featuredBanner: [
'SecretumSecretorum1',
'SecretumSecretorum2',
'SecretumSecretorum3',
'SecretumSecretorum4',
],
outfits: [{
id: 'NewmoonStarlight',
name: 'Newmoon Starlight',
description: 'Albedo\'s outfit. The Knights of Favonius alchemist\'s uniform that Albedo often wears when conducting his experiments',
picture: 'Character/Albedo/Outfit/NewmoonStarlight.png',
}],
pictures: {
icon: 'Character/Albedo/Icon.png',
sideIcon: 'Character/Albedo/SideIcon.png',
gatchaCard: 'Character/Albedo/GachaCard.png',
gachaSplash: 'Character/Albedo/GachaSplash.png',
face: 'Character/Albedo/Face.png',
halfFace: 'Character/Albedo/HalfFace.png',
profile: 'Character/Albedo/Profile.png',
weaponStance: 'Character/Albedo/WeaponStance.png',
},
signatureArtifactSet: '',
signatureWeapon: 'CinnabarSpindle',
specialDish: 'WoodlandDream',
tcgCharacterCard: 'Albedo',
weapons: ['CinnabarSpindle', 'HarbingerOfDawn', 'WolfFang'],
};

fs.writeFileSync(filePath, modifiedData);
}
function updateCharacterFile(filePath) {
const data = JSON.parse(fs.readFileSync(filePath, 'utf8'));

function traverseDirectory(directory) {
fs.readdirSync(directory, {withFileTypes: true}).forEach(entry => {
const entryPath = path.join(directory, entry.name);
if (entry.isDirectory()) {
traverseDirectory(entryPath);
} else if (entry.isFile() && entry.name.endsWith('.json')) {
processFile(entryPath);
// Add missing fields if they don't exist
for (const key in missingFields) {
// eslint-disable-next-line no-prototype-builtins
if (!data.hasOwnProperty(key)) {
data[key] = missingFields[key];
}
});
}

fs.writeFileSync(filePath, JSON.stringify(data, null, 2));
}

traverseDirectory(dataDirPath);
fs.readdirSync(dataDirPath).forEach(langFolder => {
const charFilePath = path.join(dataDirPath, langFolder, 'Character', `${charName}.json`);
if (fs.existsSync(charFilePath)) {
updateCharacterFile(charFilePath);
}
});

console.log('Files have been processed.');
console.log('Character files have been updated.');
55 changes: 8 additions & 47 deletions types/Character.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,46 +112,7 @@ export type Outfits = {
id: string;
name: string;
picture: string;
};

type EWeapon = {
/**
* @TJS-required
*/

id: string;
};

type EArtifact = {
/**
* @TJS-required
*/

id: string;
};

type EFood = {
/**
* @TJS-required
*/

id: string;
};

type EBanner = {
/**
* @TJS-required
*/

id: string;
};

type ETCGCharacterCard = {
/**
* @TJS-required
*/

id: string;
description: string;
};

export type Character = {
Expand All @@ -173,13 +134,13 @@ export type Character = {
birthday: string; // MM-DD
pictures: CharacterPicture;
outfits: undefined | Outfits[];
signatureWeapon: EWeapon;
weapons: EWeapon[];
signatureArtifactSet: undefined | EArtifact;
artifacts: EArtifact[];
specialDish: EFood;
featuredBanner: EBanner[];
tcgCharacterCard: undefined | ETCGCharacterCard;
signatureWeapon: string; // Id
weapons: string[]; // Id
signatureArtifactSet: undefined | string; // Id
artifacts: string[]; // Id
specialDish: string; // Id
featuredBanner: string[];
tcgCharacterCard: undefined | string; // Id
constellation: string;
domain: string;
cv: CharacterVoice;
Expand Down

0 comments on commit 1f4b3eb

Please sign in to comment.