0
0
mirror of https://gitlab.com/YuukiPS/GC-Resources.git synced 2025-04-28 09:05:26 +00:00

Update book and mappings

This commit is contained in:
Yuuki 2024-03-21 11:36:11 +08:00
parent 8dd3834a63
commit 6bc548be02
137 changed files with 16953 additions and 43 deletions

View File

@ -524,33 +524,49 @@ async function runMappings(version = 1) {
// Initialize the object if it's undefined // Initialize the object if it's undefined
if (!dataMappings[mapLanguageCode(lang)]) { if (!dataMappings[mapLanguageCode(lang, true)]) {
dataMappings[mapLanguageCode(lang)] = {}; dataMappings[mapLanguageCode(lang, true)] = {};
} }
const filePaths = [ const filePaths = [
'../Resources/ExcelOutput/ItemConfigAvatar.json', '../Resources/ExcelBinOutput/AvatarExcelConfigData.json',
'../Resources/ExcelOutput/ItemConfigEquipment.json' '../Resources/ExcelBinOutput/WeaponExcelConfigData.json'
]; ];
for (const filePath of filePaths) { for (const filePath of filePaths) {
try { try {
const getAvatar = await readJsonFileAsync(filePath); const getAvatar = await readJsonFileAsync(filePath);
for (const data of Object.values(getAvatar)) { for (const data of Object.values(getAvatar)) {
if (data && data.ItemName && data.ItemName.Hash) { if (data && data.nameTextMapHash) {
const hash = data.ItemName.Hash; const hash = data.nameTextMapHash;
const id = data.ID; var id = data.id;
const rank = getColorByRankLevel(data.Rarity); const rank = getColorByRankLevel(data.qualityType || data.rankLevel.toString());
const name = textMapData[hash] || `N/A`; const name = textMapData[hash] || `N/A`;
var nameType = "idk"; var nameType = "idk";
if (filePath.includes(`ItemConfigAvatar`)) { if (filePath.includes(`AvatarExcelConfigData`)) {
nameType = textMapData[`465326605`] || `N/A`;
} else if (filePath.includes(`ItemConfigEquipment`)) { /*
nameType = textMapData[`1185710709`] || `N/A`; if (id >= 11000000) {
continue // skip test avatar
}
*/
id = id % 1000 + 1000;
nameType = textMapData[`4233146695`] || `N/A`;
} else if (filePath.includes(`WeaponExcelConfigData`)) {
/*
if (id <= 11101 || id >= 20000) {
continue // skip non weapon items
}
*/
nameType = textMapData[`4231343903`] || `N/A`;
} }
dataMappings[mapLanguageCode(lang)][id] = [`${name} (${nameType})`, rank]; dataMappings[mapLanguageCode(lang, true)][id] = [`${name} (${nameType})`, rank];
} else { } else {
console.log("skip", data); console.log("skip", data);
} }
@ -561,13 +577,13 @@ async function runMappings(version = 1) {
} }
// Type Banner // Type Banner
dataMappings[mapLanguageCode(lang)][1] = textMapData[`1027493017`] || `N/A`; // Newbie dataMappings[mapLanguageCode(lang, true)][200] = textMapData[`332935371`] || `N/A`; // Standard Wish
dataMappings[mapLanguageCode(lang)][2] = textMapData[`684974156`] || `N/A`; // Normal dataMappings[mapLanguageCode(lang, true)][301] = textMapData[`2272170627`] || `N/A`; // Character Event Wish
dataMappings[mapLanguageCode(lang)][11] = textMapData[`910428004`] || `N/A`; // AvatarUp dataMappings[mapLanguageCode(lang, true)][400] = textMapData[`3352513147`] || `N/A`; // Character Event Wish-2
dataMappings[mapLanguageCode(lang)][12] = textMapData[`-641761534`] || `N/A`; // WeaponUp dataMappings[mapLanguageCode(lang, true)][302] = textMapData[`2864268523`] || `N/A`; // Weapon Event Wish
} else { } else {
const langDirectory = `../Tool/resources/${lang}/`; const langDirectory = `../Tool/resources/${mapLanguageCode(lang, false)}/`;
if (!fs.existsSync(langDirectory)) { if (!fs.existsSync(langDirectory)) {
fs.mkdirSync(langDirectory, { recursive: true }); fs.mkdirSync(langDirectory, { recursive: true });
@ -598,7 +614,8 @@ async function runMappings(version = 1) {
//runRelic(); //runRelic();
//runWeapon(); //runWeapon();
//runProp(); //runProp();
runMappings(2); //runMappings(2);
runMappings(1);
//runGiveEmu(`/give 76544 lv19 x1 15001 501064,10 501204,10 501224,10 501234,10`); //runGiveEmu(`/give 76544 lv19 x1 15001 501064,10 501204,10 501224,10 501234,10`);
//runGiveEmu(`/give 63036 lv15 s1 1:99 2:1 3:1 4:1`); //runGiveEmu(`/give 63036 lv15 s1 1:99 2:1 3:1 4:1`);
//runGiveEmu(`/give 63116 lv15 s4 4:1 7:2 8:1 9:5`); //runGiveEmu(`/give 63116 lv15 s4 4:1 7:2 8:1 9:5`);
@ -635,39 +652,40 @@ async function writeFileAsync(filePath, content, encoding = 'utf-8') {
}); });
} }
function mapLanguageCode(languageCode) { function mapLanguageCode(languageCode, useLowerCase = false) {
// Convert the language code to lowercase // http://www.lingoes.net/en/translator/langcode.htm
languageCode = languageCode.toLowerCase();
// Define a mapping for specific cases
const languageMap = { const languageMap = {
en: 'en_us', CHS: 'zh_CN',
chs: 'zh_cn', // Add more mappings as needed CHT: 'zh_TW',
cht: 'zh_tw', DE: 'de_DE', // TODO
de: 'de_de', EN: 'en_US',
es: 'es_es', ES: 'es_ES',
fr: 'fr_fr', FR: 'fr_FR',
id: 'id_id', ID: 'id_ID',
jp: 'ja_jp', JP: 'ja_JP',
kr: 'ko_kr', KR: 'ko_KR',
pt: 'pt_br', PT: 'pt_PT', // TODO
ru: 'ru_ru', RU: 'ru_RU',
th: 'th_th', TH: 'th_TH',
vi: 'vi_vn' VI: 'vi_VN',
// Add more mappings as needed IT: 'it_IT', // TODO
TR: `tr_TR` // TODO
}; };
// Check if the language code has a mapping, otherwise use the original code // Check if the language code has a mapping, otherwise use the original code
return languageMap[languageCode] || languageCode; var tus = languageMap[languageCode] || languageCode;
if (useLowerCase) {
tus = tus.toLowerCase();
}
return tus;
} }
function getColorByRankLevel(rankLevel) { function getColorByRankLevel(rankLevel) {
switch (rankLevel) { switch (rankLevel) {
case "Rare": case "3", "QUALITY_BLUE":
return "blue"; return "blue";
case "VeryRare": case "4", "QUALITY_PURPLE":
return "purple"; return "purple";
case "SuperRare": case "5", "QUALITY_ORANGE":
return "yellow"; return "yellow";
default: default:
return ""; return "";

16892
Tool/data/mappings.json Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More