* add proto AntiAddictNotify

* add cmdid csv
This commit is contained in:
Akbar Yahya 2023-04-01 14:42:51 +08:00
parent 628f7672dc
commit 8e1b8f5440
3 changed files with 2235 additions and 8 deletions

2188
cmdid_last.csv Normal file

File diff suppressed because it is too large Load Diff

42
op.js
View File

@ -4,6 +4,7 @@ const fs = require("fs");
const readline = require("readline");
// cmdid current version
const read_cmdid_last = "cmdid_last.csv";
const read_cmdid = "cmdid.csv";
const read_cmdid_output = "cmdid.json";
const read_cmdid_ht_output = "cmdid_ht_35.json";
@ -140,6 +141,7 @@ var data_gc_cmdid_nofound = [];
var check_dunp_id = [];
function update_cmdid_gc() {
let melon = "";
// cmdid_gc.json (read_cmdid_output_gc) and cmdid.json (read_cmdid_output)
const json_cmdid_last = read_json(read_cmdid_output);
@ -170,6 +172,8 @@ function update_cmdid_gc() {
nofound_cmdid_new++;
}
melon += `${name},${id}\n`;
// find dump by id
/*
var found_id = check_dunp_id.find((j) => j.id == id);
@ -240,6 +244,14 @@ function update_cmdid_gc() {
noneed_rename_name_cmdid
);
// const csvRows = Object.entries(read_cmdid_output_gc_update).map(([name, id]) => `${name},${id}`);
// const csvData = csvRows.join("\n");
fs.writeFileSync(read_cmdid_last, melon);
save_json(json_cmdid_old, read_cmdid_output_gc_update);
save_json(data_gc_cmdid_nofound, read_cmdid_output_gc_nofound);
}
@ -701,8 +713,7 @@ function clean_proto_gen_v2() {
// Use regular expressions to extract the desired part
const match = fileName.match(/^(.*)\.proto$/);
if(match == null)
{
if (match == null) {
return;
}
const messageName = match[1];
@ -798,7 +809,6 @@ function clean_proto_event() {
//console.log(rd);
while ((m = regex_import.exec(rd)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex_import.lastIndex) {
regex_import.lastIndex++;
@ -866,7 +876,7 @@ function clean_proto_event_v2() {
"ParamList",
"StrengthenPointData",
"TowerLevelEndNotify",
"TrialAvatarFirstPassDungeonNotify"
"TrialAvatarFirstPassDungeonNotify",
];
var filedonotdelete = [];
@ -890,7 +900,6 @@ function clean_proto_event_v2() {
//console.log(rd);
while ((m = regex_import.exec(rd)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex_import.lastIndex) {
regex_import.lastIndex++;
@ -956,6 +965,23 @@ function clean_proto_event_v2() {
);
}
function cmdid_json_to_csv() {
// read_cmdid_last
const k = read_json(read_cmdid_ht_output);
//console.log(k);
const csvHeaders = "ID,Name\n";
const csvRows = Object.entries(k).map(([name, id]) => `${name},${id}`);
const csvData = csvRows.join("\n");
fs.writeFileSync(read_cmdid_last, csvData);
console.log("CSV file written successfully");
}
cmdid_json_to_csv();
// Update GC Proto
// get_cmdid_gc(); // 1. get cmd old gc
// read_cmdid_ht_json(); // 2 or
@ -966,8 +992,8 @@ function clean_proto_event_v2() {
// npx prettier --write PacketOpcodes.java
// scan_gc(); // 5. scan gc
// clean_proto_event(); // 6. clean event, need manual
clean_proto_gen(); // 6. clean proto
// clean_proto_gen_v2();
//clean_proto_gen(); // 6. clean proto
// clean_proto_gen_v2();
// TODO: clean DungeonSettleNotify
// clean_proto_event_v2();
// clean_proto_event_v2();

View File

@ -0,0 +1,13 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
// Name: KLJIFBIHNPK
// CmdId: 103
message AntiAddictNotify {
int32 msg_type = 3;
string msg = 5;
string level = 14;
}