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:
parent
8dd3834a63
commit
6bc548be02
104
Tool/book.js
104
Tool/book.js
@ -524,33 +524,49 @@ async function runMappings(version = 1) {
|
||||
|
||||
|
||||
// Initialize the object if it's undefined
|
||||
if (!dataMappings[mapLanguageCode(lang)]) {
|
||||
dataMappings[mapLanguageCode(lang)] = {};
|
||||
if (!dataMappings[mapLanguageCode(lang, true)]) {
|
||||
dataMappings[mapLanguageCode(lang, true)] = {};
|
||||
}
|
||||
|
||||
const filePaths = [
|
||||
'../Resources/ExcelOutput/ItemConfigAvatar.json',
|
||||
'../Resources/ExcelOutput/ItemConfigEquipment.json'
|
||||
'../Resources/ExcelBinOutput/AvatarExcelConfigData.json',
|
||||
'../Resources/ExcelBinOutput/WeaponExcelConfigData.json'
|
||||
];
|
||||
|
||||
for (const filePath of filePaths) {
|
||||
try {
|
||||
const getAvatar = await readJsonFileAsync(filePath);
|
||||
for (const data of Object.values(getAvatar)) {
|
||||
if (data && data.ItemName && data.ItemName.Hash) {
|
||||
const hash = data.ItemName.Hash;
|
||||
const id = data.ID;
|
||||
const rank = getColorByRankLevel(data.Rarity);
|
||||
if (data && data.nameTextMapHash) {
|
||||
const hash = data.nameTextMapHash;
|
||||
var id = data.id;
|
||||
const rank = getColorByRankLevel(data.qualityType || data.rankLevel.toString());
|
||||
const name = textMapData[hash] || `N/A`;
|
||||
|
||||
var nameType = "idk";
|
||||
if (filePath.includes(`ItemConfigAvatar`)) {
|
||||
nameType = textMapData[`465326605`] || `N/A`;
|
||||
} else if (filePath.includes(`ItemConfigEquipment`)) {
|
||||
nameType = textMapData[`1185710709`] || `N/A`;
|
||||
if (filePath.includes(`AvatarExcelConfigData`)) {
|
||||
|
||||
/*
|
||||
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 {
|
||||
console.log("skip", data);
|
||||
}
|
||||
@ -561,13 +577,13 @@ async function runMappings(version = 1) {
|
||||
}
|
||||
|
||||
// Type Banner
|
||||
dataMappings[mapLanguageCode(lang)][1] = textMapData[`1027493017`] || `N/A`; // Newbie
|
||||
dataMappings[mapLanguageCode(lang)][2] = textMapData[`684974156`] || `N/A`; // Normal
|
||||
dataMappings[mapLanguageCode(lang)][11] = textMapData[`910428004`] || `N/A`; // AvatarUp
|
||||
dataMappings[mapLanguageCode(lang)][12] = textMapData[`-641761534`] || `N/A`; // WeaponUp
|
||||
dataMappings[mapLanguageCode(lang, true)][200] = textMapData[`332935371`] || `N/A`; // Standard Wish
|
||||
dataMappings[mapLanguageCode(lang, true)][301] = textMapData[`2272170627`] || `N/A`; // Character Event Wish
|
||||
dataMappings[mapLanguageCode(lang, true)][400] = textMapData[`3352513147`] || `N/A`; // Character Event Wish-2
|
||||
dataMappings[mapLanguageCode(lang, true)][302] = textMapData[`2864268523`] || `N/A`; // Weapon Event Wish
|
||||
} else {
|
||||
|
||||
const langDirectory = `../Tool/resources/${lang}/`;
|
||||
const langDirectory = `../Tool/resources/${mapLanguageCode(lang, false)}/`;
|
||||
|
||||
if (!fs.existsSync(langDirectory)) {
|
||||
fs.mkdirSync(langDirectory, { recursive: true });
|
||||
@ -598,7 +614,8 @@ async function runMappings(version = 1) {
|
||||
//runRelic();
|
||||
//runWeapon();
|
||||
//runProp();
|
||||
runMappings(2);
|
||||
//runMappings(2);
|
||||
runMappings(1);
|
||||
//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 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) {
|
||||
// Convert the language code to lowercase
|
||||
languageCode = languageCode.toLowerCase();
|
||||
|
||||
// Define a mapping for specific cases
|
||||
function mapLanguageCode(languageCode, useLowerCase = false) {
|
||||
// http://www.lingoes.net/en/translator/langcode.htm
|
||||
const languageMap = {
|
||||
en: 'en_us',
|
||||
chs: 'zh_cn', // Add more mappings as needed
|
||||
cht: 'zh_tw',
|
||||
de: 'de_de',
|
||||
es: 'es_es',
|
||||
fr: 'fr_fr',
|
||||
id: 'id_id',
|
||||
jp: 'ja_jp',
|
||||
kr: 'ko_kr',
|
||||
pt: 'pt_br',
|
||||
ru: 'ru_ru',
|
||||
th: 'th_th',
|
||||
vi: 'vi_vn'
|
||||
// Add more mappings as needed
|
||||
CHS: 'zh_CN',
|
||||
CHT: 'zh_TW',
|
||||
DE: 'de_DE', // TODO
|
||||
EN: 'en_US',
|
||||
ES: 'es_ES',
|
||||
FR: 'fr_FR',
|
||||
ID: 'id_ID',
|
||||
JP: 'ja_JP',
|
||||
KR: 'ko_KR',
|
||||
PT: 'pt_PT', // TODO
|
||||
RU: 'ru_RU',
|
||||
TH: 'th_TH',
|
||||
VI: 'vi_VN',
|
||||
IT: 'it_IT', // TODO
|
||||
TR: `tr_TR` // TODO
|
||||
};
|
||||
|
||||
// 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) {
|
||||
switch (rankLevel) {
|
||||
case "Rare":
|
||||
case "3", "QUALITY_BLUE":
|
||||
return "blue";
|
||||
case "VeryRare":
|
||||
case "4", "QUALITY_PURPLE":
|
||||
return "purple";
|
||||
case "SuperRare":
|
||||
case "5", "QUALITY_ORANGE":
|
||||
return "yellow";
|
||||
default:
|
||||
return "";
|
||||
|
16892
Tool/data/mappings.json
Normal file
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
Loading…
x
Reference in New Issue
Block a user