Update GC cmdid

This commit is contained in:
Akbar Yahya 2023-01-28 22:22:53 +08:00
parent 741da60f4f
commit b0919276ad
4 changed files with 11450 additions and 9397 deletions

15082
cmdid.json

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,92 @@
[ [
{
"name": "ChannelerSlabCheckEnterLoopDungeonReq",
"id": 8286
},
{
"name": "ChannelerSlabCheckEnterLoopDungeonRsp",
"id": 8631
},
{
"name": "ChannelerSlabEnterLoopDungeonReq",
"id": 8564
},
{
"name": "ChannelerSlabEnterLoopDungeonRsp",
"id": 8526
},
{
"name": "ChannelerSlabLoopDungeonChallengeInfoNotify",
"id": 8576
},
{
"name": "ChannelerSlabLoopDungeonSelectConditionReq",
"id": 8659
},
{
"name": "ChannelerSlabLoopDungeonSelectConditionRsp",
"id": 8858
},
{
"name": "ChannelerSlabLoopDungeonTakeFirstPassRewardReq",
"id": 8498
},
{
"name": "ChannelerSlabLoopDungeonTakeFirstPassRewardRsp",
"id": 8824
},
{
"name": "ChannelerSlabLoopDungeonTakeScoreRewardReq",
"id": 8348
},
{
"name": "ChannelerSlabLoopDungeonTakeScoreRewardRsp",
"id": 8369
},
{
"name": "ChannelerSlabOneOffDungeonInfoNotify",
"id": 8015
},
{
"name": "ChannelerSlabOneOffDungeonInfoReq",
"id": 8877
},
{
"name": "ChannelerSlabOneOffDungeonInfoRsp",
"id": 8270
},
{
"name": "ChannelerSlabSaveAssistInfoReq",
"id": 8039
},
{
"name": "ChannelerSlabSaveAssistInfoRsp",
"id": 8071
},
{ {
"name": "ChannelerSlabStageOneofDungeonNotify", "name": "ChannelerSlabStageOneofDungeonNotify",
"id": 8203 "id": 8203
}, },
{
"name": "ChannelerSlabTakeoffBuffReq",
"id": 8299
},
{
"name": "ChannelerSlabTakeoffBuffRsp",
"id": 8034
},
{
"name": "ChannelerSlabWearBuffReq",
"id": 8664
},
{
"name": "ChannelerSlabWearBuffRsp",
"id": 8285
},
{
"name": "DebugNotify",
"id": 101
},
{ {
"name": "FireworkNotify", "name": "FireworkNotify",
"id": 5934 "id": 5934
@ -28,12 +112,8 @@
"id": 5969 "id": 5969
}, },
{ {
"name": "FunitureMakeMakeInfoChangeNotify", "name": "InBattleMechanicusEscapeMonsterNotify",
"id": 4898 "id": 5400
},
{
"name": "MistTrialDunegonFailNotify",
"id": 8135
}, },
{ {
"name": "MusicGameGetBeatmapRsp", "name": "MusicGameGetBeatmapRsp",
@ -71,14 +151,6 @@
"name": "PrivateChatSetSequenceRsp", "name": "PrivateChatSetSequenceRsp",
"id": 4957 "id": 4957
}, },
{
"name": "SceneWeatherForcastReq",
"id": 3110
},
{
"name": "SceneWeatherForcastRsp",
"id": 3012
},
{ {
"name": "Unk2700_NGPMINKIOPK", "name": "Unk2700_NGPMINKIOPK",
"id": 8956 "id": 8956

File diff suppressed because it is too large Load Diff

55
op.js
View File

@ -6,6 +6,7 @@ const readline = require("readline");
// cmdid current version // cmdid current version
const read_cmdid = "cmdid.csv"; const read_cmdid = "cmdid.csv";
const read_cmdid_output = "cmdid.json"; const read_cmdid_output = "cmdid.json";
const read_cmdid_ht_output = "cmdid_ht_34.json";
const read_cmdid_output_gc = "cmdid_gc.json"; const read_cmdid_output_gc = "cmdid_gc.json";
const read_cmdid_output_gc_update = "cmdid_gc_update.json"; const read_cmdid_output_gc_update = "cmdid_gc_update.json";
const read_cmdid_output_gc_nofound = "cmdid_gc_nofound.json"; const read_cmdid_output_gc_nofound = "cmdid_gc_nofound.json";
@ -75,6 +76,28 @@ function get_cmdid_json() {
}); });
} }
var data_gen = [];
var index_file_cmdid_gen = 0;
// gen json file cmdid
function read_cmdid_ht_json() {
const k = read_json(read_cmdid_ht_output);
// console.log(k);
for (const key in k) {
if (k.hasOwnProperty(key)) {
//console.log(key + ": " + k[key]);
var subdata = new Object();
subdata["name"] = key;
subdata["id"] = parseInt(k[key]);
data_gen.push(subdata);
index_file_cmdid_gen++;
}
}
console.log("found cmd id " + index_file_cmdid_gen);
save_json(data_gen, read_cmdid_output);
}
// create cmdid from gc which comes from PacketOpcodes // create cmdid from gc which comes from PacketOpcodes
function get_cmdid_gc() { function get_cmdid_gc() {
const inputStreamcmdid = fs.createReadStream(read_cmdid_gc); const inputStreamcmdid = fs.createReadStream(read_cmdid_gc);
@ -118,12 +141,11 @@ var data_gc_cmdid_nofound = [];
var check_dunp_id = []; var check_dunp_id = [];
function update_cmdid_gc() { function update_cmdid_gc() {
// cmdid_gc.json (read_cmdid_output_gc) and cmdid.json (read_cmdid_output) // cmdid_gc.json (read_cmdid_output_gc) and cmdid.json (read_cmdid_output)
const json_cmdid_last = read_json(read_cmdid_output); const json_cmdid_last = read_json(read_cmdid_output);
const json_cmdid_old = read_json(read_cmdid_output_gc); const json_cmdid_old = read_json(read_cmdid_output_gc);
json_cmdid_old.forEach(function (s, index) { json_cmdid_old.forEach(function (s, index) {
var id = s.id; var id = s.id;
var name = s.name.trim(); var name = s.name.trim();
@ -131,7 +153,6 @@ function update_cmdid_gc() {
// switch to name mode? // switch to name mode?
var found_id = json_cmdid_last.find((j) => j.name == name); var found_id = json_cmdid_last.find((j) => j.name == name);
if (found_id) { if (found_id) {
found_cmdid_new++; found_cmdid_new++;
if (id == found_id.id) { if (id == found_id.id) {
@ -144,13 +165,10 @@ function update_cmdid_gc() {
s.id = found_id.id; // rename id s.id = found_id.id; // rename id
} }
} else { } else {
console.log("Wow nofound -> ID: " + id + " | Name: " + name); console.log("Wow nofound -> ID: " + id + " | Name: " + name);
data_gc_cmdid_nofound.push(s); data_gc_cmdid_nofound.push(s);
nofound_cmdid_new++; nofound_cmdid_new++;
} }
// find dump by id // find dump by id
@ -169,7 +187,6 @@ function update_cmdid_gc() {
*/ */
// find dump by name? // find dump by name?
}); });
check_dunp_id = []; // clear check_dunp_id = []; // clear
@ -273,14 +290,14 @@ function cmdid_to_op() {
json_cmdidfix_raw.forEach(function (s) { json_cmdidfix_raw.forEach(function (s) {
var found_id = dup_name.find((j) => j.name == s.name); var found_id = dup_name.find((j) => j.name == s.name);
if(!found_id){ if (!found_id) {
melon += "\npublic static final int " + s.name + " = " + s.id + ";"; melon += "\npublic static final int " + s.name + " = " + s.id + ";";
dup_name.push(s); dup_name.push(s);
count_nodup++; count_nodup++;
}else{ } else {
count_dup++; count_dup++;
if(s.replace){ if (s.replace) {
console.log("DUP: "+found_id.id+" > "+s.id+" "); console.log("DUP: " + found_id.id + " > " + s.id + " ");
} }
} }
//console.log(s); //console.log(s);
@ -291,7 +308,7 @@ function cmdid_to_op() {
*/ */
}); });
console.log("done no dup "+count_nodup+" | dup "+count_dup); console.log("done no dup " + count_nodup + " | dup " + count_dup);
melon += "\n}"; melon += "\n}";
save(melon, write_op); // use "npx prettier --write PacketOpcodes.java" for better Formatter save(melon, write_op); // use "npx prettier --write PacketOpcodes.java" for better Formatter
@ -555,7 +572,7 @@ function clean_proto_gen() {
if (found_proto) { if (found_proto) {
// if found import // if found import
if (found_proto.import) { if (found_proto.import) {
found_proto.import.forEach(function (s) { found_proto.import.forEach(function (s) {
var f = noe.find((j) => j === s); var f = noe.find((j) => j === s);
if (!f) { if (!f) {
noe.push(s); noe.push(s);
@ -719,8 +736,10 @@ function scan_gc() {
// get_cmdid_gc(); // 1. get cmd old gc // get_cmdid_gc(); // 1. get cmd old gc
// get_cmdid_json(); // 2. get last cmdid.csv to json // get_cmdid_json(); // 2. get last cmdid.csv to json
// now we have cmdid_gc.json and cmdid.json // now we have cmdid_gc.json and cmdid.json
// update_cmdid_gc(); // 3. update gc cmdid (mode by id) update_cmdid_gc(); // 3. update gc cmdid (mode by id)
// cmdid_to_op(); // 4. update op // cmdid_to_op(); // 4. update op
// npx prettier --write PacketOpcodes.java // npx prettier --write PacketOpcodes.java
// scan_gc(); // 5. scan gc // scan_gc(); // 5. scan gc
// clean_proto_gen(); // 6. clean proto // clean_proto_gen(); // 6. clean proto
//read_cmdid_ht_json();