mirror of
https://gitlab.com/YuukiPS/GC-Proto.git
synced 2024-12-25 07:59:24 +03:00
add fixed name based on latest data proto.
include those that are not known maybe because it's custom or latest version has been removed.
This commit is contained in:
parent
a4bd28fe02
commit
61ace18318
62
cmdid_gc_nofound.json
Normal file
62
cmdid_gc_nofound.json
Normal file
@ -0,0 +1,62 @@
|
||||
[
|
||||
{
|
||||
"name": "FireworkNotify",
|
||||
"id": 5934
|
||||
},
|
||||
{
|
||||
"name": "FireworkReq",
|
||||
"id": 6068
|
||||
},
|
||||
{
|
||||
"name": "FireworkRsp",
|
||||
"id": 5918
|
||||
},
|
||||
{
|
||||
"name": "FireworkSetNotify",
|
||||
"id": 6079
|
||||
},
|
||||
{
|
||||
"name": "FireworkSetReq",
|
||||
"id": 6099
|
||||
},
|
||||
{
|
||||
"name": "FireworkSetRsp",
|
||||
"id": 5969
|
||||
},
|
||||
{
|
||||
"name": "MusicGameGetBeatmapRsp",
|
||||
"id": 6309
|
||||
},
|
||||
{
|
||||
"name": "MusicGameCreateBeatmapRsp",
|
||||
"id": 6347
|
||||
},
|
||||
{
|
||||
"name": "MusicGameSearchBeatmapRsp",
|
||||
"id": 6304
|
||||
},
|
||||
{
|
||||
"name": "MusicGameSearchBeatmapReq",
|
||||
"id": 6343
|
||||
},
|
||||
{
|
||||
"name": "MusicGameStartToPlayOthersBeatmapReq",
|
||||
"id": 6302
|
||||
},
|
||||
{
|
||||
"name": "MusicGameStartToPlayOthersBeatmapRsp",
|
||||
"id": 6313
|
||||
},
|
||||
{
|
||||
"name": "PrivateChatSetSequenceReq",
|
||||
"id": 4985
|
||||
},
|
||||
{
|
||||
"name": "PrivateChatSetSequenceRsp",
|
||||
"id": 4957
|
||||
},
|
||||
{
|
||||
"name": "Unk2700_NGPMINKIOPK",
|
||||
"id": 8956
|
||||
}
|
||||
]
|
7674
cmdid_gc_update.json
Normal file
7674
cmdid_gc_update.json
Normal file
File diff suppressed because it is too large
Load Diff
80
op.js
80
op.js
@ -7,6 +7,8 @@ const readline = require("readline");
|
||||
const read_cmdid = "cmdid.csv";
|
||||
const read_cmdid_output = "cmdid.json";
|
||||
const read_cmdid_output_gc = "cmdid_gc.json";
|
||||
const read_cmdid_output_gc_update = "cmdid_gc_update.json";
|
||||
const read_cmdid_output_gc_nofound = "cmdid_gc_nofound.json";
|
||||
|
||||
console.log(process.cwd());
|
||||
|
||||
@ -58,17 +60,11 @@ function get_cmdid_json() {
|
||||
});
|
||||
lineReadercmdid.on("close", function () {
|
||||
console.log("found cmd id " + index_file_cmdid);
|
||||
var strNotes = JSON.stringify(data, null, 4);
|
||||
fs.writeFile(read_cmdid_output, strNotes, "utf8", function (err) {
|
||||
if (err) {
|
||||
console.log("An error occured while writing JSON Object to File.");
|
||||
return console.log(err);
|
||||
}
|
||||
console.log("JSON file has been saved.");
|
||||
});
|
||||
save_json(data, read_cmdid_output);
|
||||
});
|
||||
}
|
||||
|
||||
// create cmdid from gc which comes from PacketOpcodes
|
||||
function get_cmdid_gc() {
|
||||
const inputStreamcmdid = fs.createReadStream(read_cmdid_gc);
|
||||
var lineReadercmdid = readline.createInterface({
|
||||
@ -82,7 +78,7 @@ function get_cmdid_gc() {
|
||||
if (name.includes("public static final int")) {
|
||||
name = name.replace("\tpublic static final int ", "");
|
||||
// skip 0 ?
|
||||
if(id == 0){
|
||||
if (id == 0) {
|
||||
return;
|
||||
}
|
||||
var subdata = new Object();
|
||||
@ -94,28 +90,74 @@ function get_cmdid_gc() {
|
||||
} else {
|
||||
index_cmdid_gc_out++;
|
||||
}
|
||||
/*
|
||||
var subdata = new Object();
|
||||
subdata["name"] = config[0];
|
||||
subdata["id"] = parseInt(config[1]);
|
||||
data.push(subdata);
|
||||
*/
|
||||
});
|
||||
lineReadercmdid.on("close", function () {
|
||||
console.log(
|
||||
"found cmd id " + index_cmdid_gc + " | no need " + index_cmdid_gc_out
|
||||
);
|
||||
var strNotes = JSON.stringify(data_gc, null, 4);
|
||||
fs.writeFile(read_cmdid_output_gc, strNotes, "utf8", function (err) {
|
||||
save_json(data_gc, read_cmdid_output_gc);
|
||||
});
|
||||
}
|
||||
|
||||
var found_cmdid_new = 0;
|
||||
var nofound_cmdid_new = 0;
|
||||
var rename_name_cmdid = 0;
|
||||
var noneed_rename_name_cmdid = 0;
|
||||
var data_gc_cmdid_nofound = [];
|
||||
|
||||
function update_cmdid_gc() {
|
||||
const cmd_last = fs.readFileSync(read_cmdid_output);
|
||||
const cmd_old = fs.readFileSync(read_cmdid_output_gc);
|
||||
const json_cmdid_last = JSON.parse(cmd_last);
|
||||
const json_cmdid_old = JSON.parse(cmd_old);
|
||||
json_cmdid_old.forEach(function (s) {
|
||||
var id = s.id;
|
||||
var name = s.name;
|
||||
|
||||
var found_id = json_cmdid_last.find((j) => j.id == id);
|
||||
if (found_id) {
|
||||
found_cmdid_new++;
|
||||
if (name == found_id.name) {
|
||||
noneed_rename_name_cmdid++;
|
||||
} else {
|
||||
rename_name_cmdid++;
|
||||
//console.log("Wow rename -> ID: "+id+" | Name: "+name+" > "+found_id.name);
|
||||
// rename json_cmdid_old
|
||||
s.name = found_id.name;
|
||||
}
|
||||
} else {
|
||||
//console.log("Wow nofound -> ID: " + id + " | Name: " + name);
|
||||
data_gc_cmdid_nofound.push(s);
|
||||
nofound_cmdid_new++;
|
||||
}
|
||||
});
|
||||
console.log(
|
||||
"found " +
|
||||
found_cmdid_new +
|
||||
" | no found " +
|
||||
nofound_cmdid_new +
|
||||
" | rename " +
|
||||
rename_name_cmdid +
|
||||
" | noneed rename " +
|
||||
noneed_rename_name_cmdid
|
||||
);
|
||||
save_json(json_cmdid_old, read_cmdid_output_gc_update);
|
||||
save_json(data_gc_cmdid_nofound, read_cmdid_output_gc_nofound);
|
||||
}
|
||||
|
||||
// save json
|
||||
function save_json(raw, file) {
|
||||
var j = JSON.stringify(raw, null, 4);
|
||||
fs.writeFile(file, j, "utf8", function (err) {
|
||||
if (err) {
|
||||
console.log("An error occured while writing JSON Object to File.");
|
||||
return console.log(err);
|
||||
}
|
||||
console.log("JSON file has been saved.");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
get_cmdid_gc();
|
||||
update_cmdid_gc();
|
||||
//get_cmdid_gc();
|
||||
//get_cmdid_json();
|
||||
//check_gen();
|
||||
|
Loading…
Reference in New Issue
Block a user