@xmobitea/gn-server 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +568 -567
- package/package.json +2 -2
- package/GNconfig.debug.json +0 -83
- package/syncCode.js +0 -1016
- package/syncCodeVer2.js +0 -176
package/syncCodeVer2.js
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
const fs = require("fs");
|
|
3
|
-
const path = require("path");
|
|
4
|
-
|
|
5
|
-
let docs = [];
|
|
6
|
-
|
|
7
|
-
let tsLastUpdate = 1736498427663;
|
|
8
|
-
|
|
9
|
-
docs.push({
|
|
10
|
-
"type": "system",
|
|
11
|
-
"version": "FIRSTVER",
|
|
12
|
-
"fullScript": "// first full script",
|
|
13
|
-
"tsLastUpdate": tsLastUpdate,
|
|
14
|
-
"childScripts": [
|
|
15
|
-
{
|
|
16
|
-
"eventName": "system_OnEveryMinute",
|
|
17
|
-
"script": "\nsystemHandlers.system_OnEveryMinute = async (log: (log: any) => void) => {\n\n}\n",
|
|
18
|
-
"hasEdit": false
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"eventName": "system_OnEveryHour",
|
|
22
|
-
"script": "\nsystemHandlers.system_OnEveryHour = async (log: (log: any) => void) => {\n\n}\n",
|
|
23
|
-
"hasEdit": false
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"eventName": "system_OnEveryDay",
|
|
27
|
-
"script": "\nsystemHandlers.system_OnEveryDay = async (log: (log: any) => void) => {\n\n}\n",
|
|
28
|
-
"hasEdit": false
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"eventName": "system_RequestServerDetail",
|
|
32
|
-
"script": "\nsystemMatchmakingHandlers.system_RequestServerDetail = async (gameId: string, matchmakingTicketCanMatch: MatchmakingTicketCanMatch, log: (log: any) => void): Promise<{ success: boolean }> => {\n\t//call matchmaking.confirmServerDetail(gameId, matchmakingTicketCanMatch, { ipV4Address: '127.0.0.1', ports: [{ name: 'GamePort', publicPort: 2202, privatePort: 3000, protocol: 1 }] }); // after setup success a dedicated server;\n\treturn { success: false };\n}\n",
|
|
33
|
-
"hasEdit": false
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
docs.push(readAllTsFiles("authenticate"));
|
|
39
|
-
docs.push(readAllTsFiles("characterPlayer"));
|
|
40
|
-
docs.push(readAllTsFiles("cloudScript"));
|
|
41
|
-
docs.push(readAllTsFiles("content"));
|
|
42
|
-
docs.push(readAllTsFiles("dashboard"));
|
|
43
|
-
docs.push(readAllTsFiles("gamePlayer"));
|
|
44
|
-
docs.push(readAllTsFiles("group"));
|
|
45
|
-
docs.push(readAllTsFiles("inventory"));
|
|
46
|
-
docs.push(readAllTsFiles("masterPlayer"));
|
|
47
|
-
docs.push(readAllTsFiles("multiplayer"));
|
|
48
|
-
docs.push(readAllTsFiles("storeInventory"));
|
|
49
|
-
|
|
50
|
-
writeJson(docs);
|
|
51
|
-
|
|
52
|
-
function readAllTsFiles(name) {
|
|
53
|
-
let directory = "./src/GN-app-api/handler/controller/handler/" + name;
|
|
54
|
-
|
|
55
|
-
let answer = {
|
|
56
|
-
type: name,
|
|
57
|
-
version: "FIRSTVER",
|
|
58
|
-
fullScript: "// first full script",
|
|
59
|
-
tsLastUpdate: tsLastUpdate,
|
|
60
|
-
childScripts: [],
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
// Lấy danh sách tất cả các file và folder trong thư mục
|
|
65
|
-
const files = fs.readdirSync(directory, { withFileTypes: true });
|
|
66
|
-
|
|
67
|
-
for (const file of files) {
|
|
68
|
-
const filePath = path.join(directory, file.name);
|
|
69
|
-
|
|
70
|
-
if (file.isDirectory()) {
|
|
71
|
-
|
|
72
|
-
} else if (file.isFile() && !file.name.endsWith('BaseRequestHandler.ts') && file.name != "MatchmakingHandler.ts" && file.name.endsWith('.ts')) {
|
|
73
|
-
// Nếu là file .ts, đọc nội dung file
|
|
74
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
75
|
-
|
|
76
|
-
let lines = content.split("\n");
|
|
77
|
-
|
|
78
|
-
let line2;
|
|
79
|
-
|
|
80
|
-
for (let i = 0; i < lines.length; i++) {
|
|
81
|
-
let line = lines[i];
|
|
82
|
-
|
|
83
|
-
let trim = line.trimStart();
|
|
84
|
-
if (trim.startsWith("private async execute(")) {
|
|
85
|
-
line2 = line;
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (!line2) {
|
|
91
|
-
console.log("filePath not has data " + filePath);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
// line2 = private async execute(request: { userId: string, eventCode: number, eventParameters: { [k: string]: any }, eventEncrypted: boolean }, secretInfo: SecretInfo, operationRequest: OperationRequest): Promise<OperationResponse> {
|
|
95
|
-
|
|
96
|
-
// line2.split("(")[1] = request: { userId: string, eventCode: number, eventParameters: { [k: string]: any }, eventEncrypted: boolean }, secretInfo: SecretInfo, operationRequest: OperationRequest): Promise<OperationResponse> {
|
|
97
|
-
|
|
98
|
-
// line2 = private async execute(request: { serviceName: string, serviceData: { [k: string]: any }, createPlayerIfNotExists: boolean, infoRequestParam: InfoRequestParam, ipAddress: string }, secretInfo: SecretInfo, operationRequest: OperationRequest): Promise<OperationResponse> {
|
|
99
|
-
|
|
100
|
-
// line2s[0] = private async execute
|
|
101
|
-
// line2s[1] = request: { serviceName: string, serviceData: { [k: string]: any }, createPlayerIfNotExists: boolean, infoRequestParam: InfoRequestParam, ipAddress: string }, secretInfo: SecretInfo, operationRequest: OperationRequest): Promise<OperationResponse> {
|
|
102
|
-
// finalLine2 = request: { serviceName: string, serviceData: { [k: string]: any }, createPlayerIfNotExists: boolean, infoRequestParam: InfoRequestParam, ipAddress: string }, secretInfo: SecretInfo, operationRequest: OperationRequest): Promise<OperationResponse> {
|
|
103
|
-
|
|
104
|
-
// line3s[0] = request: { serviceName: string, serviceData: { [k: string]: any }, createPlayerIfNotExists: boolean, infoRequestParam: InfoRequestParam, ipAddress: string }, secretInfo: SecretInfo, operationRequest: OperationRequest
|
|
105
|
-
// line3s[1] = : Promise<OperationResponse> {
|
|
106
|
-
// finalLine3 = request: { serviceName: string, serviceData: { [k: string]: any }, createPlayerIfNotExists: boolean, infoRequestParam: InfoRequestParam, ipAddress: string }, secretInfo: SecretInfo, operationRequest: OperationRequest
|
|
107
|
-
|
|
108
|
-
// line4s[0] = request: { serviceName: string, serviceData: { [k: string]: any
|
|
109
|
-
// line4s[1] = , createPlayerIfNotExists: boolean, infoRequestParam: InfoRequestParam, ipAddress: string
|
|
110
|
-
// line4s[2] = , secretInfo: SecretInfo, operationRequest: OperationRequest
|
|
111
|
-
|
|
112
|
-
let line2s = line2.split("(");
|
|
113
|
-
let finalLine2 = "";
|
|
114
|
-
for (let i = 1; i < line2s.length; i++) {
|
|
115
|
-
finalLine2 += line2s[i];
|
|
116
|
-
if (i < line2s.length - 1) finalLine2 += "(";
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
let line3s = finalLine2.split(")");
|
|
120
|
-
let finalLine3 = "";
|
|
121
|
-
for (let i = 0; i < line3s.length - 1; i++) {
|
|
122
|
-
finalLine3 += line3s[i];
|
|
123
|
-
|
|
124
|
-
if (i < line3s.length - 2) finalLine3 += ")";
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
//async (request: { androidDeviceId: string, createPlayerIfNotExists: boolean, infoRequestParam: authenticate_InfoRequestParam, ipAddress: string }, secretInfo: SecretInfo, operationRequest: OperationRequest)
|
|
128
|
-
//async (request: { gameId: string, requestParams: ServerGameDataRequestParams }, secretInfo: SecretInfo, operationRequest: OperationRequest)
|
|
129
|
-
let line4s = finalLine3.split("}");
|
|
130
|
-
let finalLine4 = "";
|
|
131
|
-
for (let i = 0; i < line4s.length - 1; i++) {
|
|
132
|
-
finalLine4 += line4s[i];
|
|
133
|
-
|
|
134
|
-
if (i < line4s.length - 2) finalLine4 += "}";
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
let spls2 = finalLine4 + "}";
|
|
138
|
-
|
|
139
|
-
spls2 = spls2
|
|
140
|
-
.replace("infoRequestParam: InfoRequestParam", "infoRequestParam: " + name + "_InfoRequestParam");
|
|
141
|
-
|
|
142
|
-
let childScript = {
|
|
143
|
-
eventName: name + "_" + file.name.replace("RequestHandler.ts", ""),
|
|
144
|
-
script: "",
|
|
145
|
-
hasEdit: false,
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
let script = "\n";
|
|
150
|
-
script += "preHandlers." + childScript.eventName + " = async (" + spls2 + ", secretInfo: SecretInfo, operationRequest: OperationRequest, log: (log: any) => void) => {\n"
|
|
151
|
-
script += "\n";
|
|
152
|
-
script += "\treturn null;\n"
|
|
153
|
-
script += "}\n";
|
|
154
|
-
script += "\n";
|
|
155
|
-
|
|
156
|
-
script += "postHandlers." + childScript.eventName + " = async (" + spls2 + ", secretInfo: SecretInfo, operationRequest: OperationRequest, operationResponse: OperationResponse, log: (log: any) => void) => {\n"
|
|
157
|
-
script += "\n";
|
|
158
|
-
script += "\treturn operationResponse;\n"
|
|
159
|
-
script += "}\n";
|
|
160
|
-
|
|
161
|
-
childScript.script = script;
|
|
162
|
-
|
|
163
|
-
answer.childScripts.push(childScript);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
} catch (error) {
|
|
168
|
-
console.error('Error reading files:', error);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return answer;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
function writeJson(docs) {
|
|
175
|
-
fs.writeFileSync("./src/GN-startup/cloudScript/eventCallbackCloudScriptData.json", JSON.stringify(docs, null, 4));
|
|
176
|
-
}
|