mirror of
https://gitlab.com/YuukiPS/GC-Resources.git
synced 2025-01-05 10:17:17 +08:00
update script
This commit is contained in:
parent
40c3c24639
commit
93872a3aa0
6
.gitignore
vendored
6
.gitignore
vendored
@ -4,10 +4,10 @@ scene_grid.json
|
||||
# folder
|
||||
Tool/icon
|
||||
Tool/*.json
|
||||
Tool/AllExcel/*
|
||||
Tool/FoundExcel/*
|
||||
Tool/AllExcel/
|
||||
Tool/FoundExcel/
|
||||
Tool/Patches/
|
||||
Tool/Quest/
|
||||
Tool/Quest32/
|
||||
Tool/Dump/
|
||||
.idea/
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
|
||||
const questData3_2 = "QuestExcelConfigData (3.2).json";
|
||||
const questData3_2 = "QuestExcelConfigData_3.2.json";
|
||||
const fileOutput = path.join(__dirname,"../Resources/ExcelBinOutput/QuestExcelConfigData.json");
|
||||
|
||||
if (!fs.existsSync(questData3_2)) {
|
||||
console.log(
|
||||
"Place a copy of QuestExcelConfigData for game version 3.2 in the same directory as this script."
|
||||
);
|
||||
console.log("Place a copy of QuestExcelConfigData for game version 3.2 ori or 4.0 mod in same directory as this script.");
|
||||
console.log(`Name the file ${questData3_2}.`);
|
||||
return;
|
||||
}
|
||||
|
||||
const questPatches32Bin = "Quest";
|
||||
const questPatches32Bin = "Quest32";
|
||||
|
||||
const questPatchesDir = "Patches/Quest";
|
||||
if (!fs.existsSync(questPatchesDir)) {
|
||||
@ -22,13 +22,20 @@ if (!fs.existsSync(questPatchesDir)) {
|
||||
}
|
||||
// btw use `npx prettier --write .` in folder scene after patch
|
||||
|
||||
// Define constants.
|
||||
// This should only be done if it is truly unknown and should only be done manually quest
|
||||
const unknownCondition = {
|
||||
type: "QUEST_COND_UNKNOWN",
|
||||
param: [0, 0],
|
||||
param_str: ""
|
||||
};
|
||||
|
||||
// Not all quests have cond in 3.2 but they are already known so it should be QUEST_COND_NONE right?
|
||||
const NoneCondition = {
|
||||
type: "QUEST_COND_NONE",
|
||||
param: [0, 0],
|
||||
param_str: ""
|
||||
};
|
||||
|
||||
const questBlacklist = [
|
||||
"acceptCond",
|
||||
"finishCond",
|
||||
@ -198,10 +205,6 @@ function removeFields(object, blacklist = []) {
|
||||
}
|
||||
|
||||
const binOutput = path.join(__dirname, "../Resources/BinOutput/Quest");
|
||||
const fileOutput = path.join(
|
||||
__dirname,
|
||||
"../Resources/ExcelBinOutput/QuestExcelConfigData.json"
|
||||
);
|
||||
const mainQuestFile = path.join(
|
||||
__dirname,
|
||||
"../Resources/ExcelBinOutput/MainQuestExcelConfigData.json"
|
||||
@ -268,18 +271,18 @@ for (const mainQuestData of mainQuest_data) {
|
||||
if (check_new.length == 0) {
|
||||
|
||||
// if new not found, find alt
|
||||
|
||||
//process.exit()
|
||||
|
||||
if (fs.existsSync(binfile)) {
|
||||
const binsub_d = JSON.parse(fs.readFileSync(binfile));
|
||||
let r = binsub_d.subQuests;
|
||||
if (r !== undefined) {
|
||||
//main_data.subQuests = r; // copy `bin sub quest` to `config main_data for sub quest` (copy as laset quest bin)
|
||||
if (r) {
|
||||
main_data = r; // copy `bin sub quest` to `config main_data for sub quest` (copy as laset quest bin)
|
||||
} else {
|
||||
console.log(`not found sub quest alternatives quest main ${binfile}`);
|
||||
console.log(`not found sub quest alternatives quest main ${binfile}`, binsub_d);
|
||||
}
|
||||
} else {
|
||||
console.log(`not found alternatives quest main ${binfile}`);
|
||||
console.log(`not found file bin sub quest: ${binfile}`);
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -295,21 +298,16 @@ for (const mainQuestData of mainQuest_data) {
|
||||
|
||||
}
|
||||
|
||||
// Find all talks for main quest.
|
||||
const talks = talks_data.filter((talk) => talk.questId === mainQuestId);
|
||||
|
||||
// Check if quest has sub-quests. (main_data as subQuests)
|
||||
if (main_data.length == 0) {
|
||||
console.log(`Main quest ${mainQuestId} has no sub-quests, skipping...`);
|
||||
console.log(`Main quest ${mainQuestId} has no sub-quests, skipping...`, mainQuestData);
|
||||
continue;
|
||||
}
|
||||
|
||||
//console.log("=====================================");
|
||||
//console.log(`Performing merge on main quest ${mainQuestId}.`);
|
||||
//console.log(`This quest is ${isNewQuest ? "new" : "old"}.`);
|
||||
//console.log(`There are ${main_data.length} sub-quests.`);
|
||||
//console.log(`There are ${talks.length} talks.`);
|
||||
//console.log("=====================================");
|
||||
console.log("=====================================");
|
||||
console.log(`Performing merge on main quest ${mainQuestId}.`);
|
||||
console.log(`There are ${main_data.length} sub-quests.`);
|
||||
console.log("=====================================");
|
||||
|
||||
// Create the base quest data.
|
||||
const quest_bin = {
|
||||
@ -368,6 +366,9 @@ for (const mainQuestData of mainQuest_data) {
|
||||
...subQuestBin,
|
||||
};
|
||||
|
||||
//console.log(subQuest_config)
|
||||
//process.exit(1)
|
||||
|
||||
// Validate conditions.
|
||||
const {
|
||||
/** @type any[] */ acceptCond,
|
||||
@ -416,13 +417,25 @@ for (const mainQuestData of mainQuest_data) {
|
||||
// fix null
|
||||
// acceptCond (this is always there)
|
||||
if (subQuest_config.acceptCond == null) {
|
||||
subQuest_config.acceptCond = [unknownCondition];
|
||||
|
||||
if (bin32config) {
|
||||
subQuest_config.acceptCond = [NoneCondition];
|
||||
}else{
|
||||
subQuest_config.acceptCond = [unknownCondition];
|
||||
}
|
||||
|
||||
console.log(`no acceptCond for ${mainQuestId} / ${subQuestBin.subId}`);
|
||||
count_no_acceptCond++;
|
||||
}
|
||||
// finishCond (this is always there)
|
||||
if (subQuest_config.finishCond == null) {
|
||||
subQuest_config.finishCond = [unknownCondition];
|
||||
|
||||
if (bin32config) {
|
||||
subQuest_config.finishCond = [NoneCondition];
|
||||
}else{
|
||||
subQuest_config.finishCond = [unknownCondition];
|
||||
}
|
||||
|
||||
console.log(`no finishCond for ${mainQuestId} / ${subQuestBin.subId}`);
|
||||
count_no_finishCond++;
|
||||
}
|
||||
@ -446,7 +459,6 @@ for (const mainQuestData of mainQuest_data) {
|
||||
|
||||
// Validate quest guide (in config quest)
|
||||
const { guide } = subQuestBin;
|
||||
// || guide.type !== null
|
||||
if (guide !== undefined && guide.type !== undefined) {
|
||||
subQuest_config.guide = cleanGuide(guide);
|
||||
} else subQuest_config.guide = {};
|
||||
@ -460,6 +472,7 @@ for (const mainQuestData of mainQuest_data) {
|
||||
}
|
||||
|
||||
//console.log(subQuest_config)
|
||||
//process.exit(1)
|
||||
|
||||
// Add to the main quest's collection.
|
||||
const subQuestForMain = Object.assign({}, subQuest_config);
|
||||
@ -472,6 +485,8 @@ for (const mainQuestData of mainQuest_data) {
|
||||
quests_config.push(subQuest_config);
|
||||
}
|
||||
|
||||
// Find all talks for main quest.
|
||||
const talks = talks_data.filter((talk) => talk.questId === mainQuestId);
|
||||
// Create talks for the main quest.
|
||||
for (const talkData of talks) {
|
||||
const talk = {
|
||||
|
@ -811,7 +811,7 @@ async function runMappings(version = 1) {
|
||||
//await runRelic(langDirectory, getHashLANG, true)
|
||||
//await runWeapon(langDirectory, getHashLANG, true)
|
||||
//runProp(langDirectory, getHashLANG)
|
||||
//runQuest(langDirectory, getHashLANG)
|
||||
runQuest(langDirectory, getHashLANG)
|
||||
}
|
||||
}
|
||||
|
||||
@ -831,7 +831,7 @@ async function runMappings(version = 1) {
|
||||
//runRelic();
|
||||
//runWeapon();
|
||||
//runProp();
|
||||
runMappings(1);
|
||||
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`);
|
||||
|
Loading…
Reference in New Issue
Block a user