From c5ea3b976ff68fe10032dcc0fe02dd39b22850de Mon Sep 17 00:00:00 2001 From: wuyanchen <307378529@qq.com> Date: Wed, 31 Dec 2025 19:46:37 +0800 Subject: [PATCH] =?UTF-8?q?=C2=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 78 ++++++--- src/XNetEventKeys.ts | 307 +++++++++++++++++++---------------- src/manager/PlayerManager.ts | 46 +----- 3 files changed, 220 insertions(+), 211 deletions(-) diff --git a/package-lock.json b/package-lock.json index f048e92..6d38ca8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -78,7 +78,6 @@ "resolved": "https://registry.npmjs.org/@colyseus/core/-/core-0.16.22.tgz", "integrity": "sha512-9UsiS2ecIUxqjL2uX34UMfLUnyNaXIaCAP2k4t6YAwO9yWrhjWGewzYGnoI9cpUu+FzA8X3T6XUwb1EQ3e1u/g==", "license": "MIT", - "peer": true, "dependencies": { "@colyseus/greeting-banner": "^2.0.6", "@colyseus/msgpackr": "^1.11.2", @@ -231,7 +230,6 @@ "version": "0.16.1", "resolved": "https://registry.npmmirror.com/@colyseus/redis-driver/-/redis-driver-0.16.1.tgz", "integrity": "sha512-dFDyyVEBemfdeHrO2fTt86803fV8iMepGi6UHD7feR7vQO9bdN6yXpAyrBWMJrfBs8EFuEEb73gM3mDUjppH/A==", - "peer": true, "dependencies": { "@colyseus/core": "^0.16.4", "ioredis": "^5.3.2" @@ -242,7 +240,6 @@ "resolved": "https://registry.npmjs.org/@colyseus/redis-presence/-/redis-presence-0.16.4.tgz", "integrity": "sha512-dROj2T6eqxsquGQQuwqWuBjDDNHj33KKyltWiUMP/dFyPYVG6fFZl+IbHDo3rmRB1RdmjwtEYt9/Bz/Bsszvxw==", "license": "MIT", - "peer": true, "dependencies": { "@colyseus/core": "^0.16.19", "ioredis": "^5.3.2" @@ -252,7 +249,6 @@ "version": "3.0.35", "resolved": "https://registry.npmmirror.com/@colyseus/schema/-/schema-3.0.35.tgz", "integrity": "sha512-cqJqxxlhF/cBldezaKW6/ZIUHKuvBUs6vdnjnTLEX9w+E2aYbF4BVy1EdUc63LRyXy08BwhJMuS9HPTAV9vj0g==", - "peer": true, "bin": { "schema-codegen": "bin/schema-codegen", "schema-debug": "bin/schema-debug" @@ -288,7 +284,6 @@ "resolved": "https://registry.npmjs.org/@colyseus/tools/-/tools-0.16.14.tgz", "integrity": "sha512-eLwg1orG7lLTzi7YgHeOT0S6wGhpzhcqRmTkLZ98nrWgiE6EOq6uVjfaiekTO7a7LByyCzBRwkKMzTSZ6as10Q==", "license": "MIT", - "peer": true, "dependencies": { "@pm2/io": "^6.0.1", "cors": "^2.8.5", @@ -310,7 +305,6 @@ "resolved": "https://registry.npmjs.org/@colyseus/uwebsockets-transport/-/uwebsockets-transport-0.16.10.tgz", "integrity": "sha512-AgAcMNWaguN7QjTENZm0e604sjpXa6By17MYGDMrqlYKkVtKKHCx8rIPfB7WPWXRmEZbgPQP3Z6rte+dgjtBgw==", "license": "MIT", - "peer": true, "dependencies": { "uwebsockets-express": "^1.3.8", "uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.49.0" @@ -336,6 +330,7 @@ "version": "8.18.1", "resolved": "https://registry.npmmirror.com/ws/-/ws-8.18.1.tgz", "integrity": "sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w==", + "peer": true, "engines": { "node": ">=10.0.0" }, @@ -954,7 +949,6 @@ "version": "6.1.0", "resolved": "https://registry.npmmirror.com/@pm2/io/-/io-6.1.0.tgz", "integrity": "sha512-IxHuYURa3+FQ6BKePlgChZkqABUKFYH6Bwbw7V/pWU1pP6iR1sCI26l7P9ThUEB385ruZn/tZS3CXDUF5IA1NQ==", - "peer": true, "dependencies": { "async": "~2.6.1", "debug": "~4.3.1", @@ -1030,6 +1024,7 @@ "version": "9.0.9", "resolved": "https://registry.npmmirror.com/@types/jsonwebtoken/-/jsonwebtoken-9.0.9.tgz", "integrity": "sha512-uoe+GxEuHbvy12OUQct2X9JenKM3qAscquYymuQN4fMWG9DBQtykrQEFcAbVACF7qaLw9BePSodUL0kquqBJpQ==", + "peer": true, "dependencies": { "@types/ms": "*", "@types/node": "*" @@ -1112,6 +1107,7 @@ "version": "8.18.1", "resolved": "https://registry.npmmirror.com/@types/ws/-/ws-8.18.1.tgz", "integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==", + "peer": true, "dependencies": { "@types/node": "*" } @@ -1229,6 +1225,7 @@ "resolved": "https://registry.npmmirror.com/asn1.js/-/asn1.js-5.4.1.tgz", "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", "optional": true, + "peer": true, "dependencies": { "bn.js": "^4.0.0", "inherits": "^2.0.1", @@ -1353,7 +1350,8 @@ "version": "4.12.2", "resolved": "https://registry.npmmirror.com/bn.js/-/bn.js-4.12.2.tgz", "integrity": "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw==", - "optional": true + "optional": true, + "peer": true }, "node_modules/body-parser": { "version": "2.2.0", @@ -1424,7 +1422,8 @@ "version": "1.1.0", "resolved": "https://registry.npmmirror.com/brorand/-/brorand-1.1.0.tgz", "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", - "optional": true + "optional": true, + "peer": true }, "node_modules/browser-stdout": { "version": "1.3.1", @@ -1467,7 +1466,8 @@ "node_modules/buffer-equal-constant-time": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "peer": true }, "node_modules/bytes": { "version": "3.1.2", @@ -1771,6 +1771,7 @@ "version": "7.1.1", "resolved": "https://registry.npmmirror.com/connect-redis/-/connect-redis-7.1.1.tgz", "integrity": "sha512-M+z7alnCJiuzKa8/1qAYdGUXHYfDnLolOGAUjOioB07pP39qxjG+X9ibsud7qUBc4jMV5Mcy3ugGv8eFcgamJQ==", + "peer": true, "engines": { "node": ">=16" }, @@ -1991,6 +1992,7 @@ "version": "1.0.11", "resolved": "https://registry.npmmirror.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "peer": true, "dependencies": { "safe-buffer": "^5.0.1" } @@ -2006,6 +2008,7 @@ "resolved": "https://registry.npmmirror.com/elliptic/-/elliptic-6.6.1.tgz", "integrity": "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==", "optional": true, + "peer": true, "dependencies": { "bn.js": "^4.11.9", "brorand": "^1.1.0", @@ -2178,7 +2181,6 @@ "resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz", "integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==", "license": "MIT", - "peer": true, "dependencies": { "accepts": "^2.0.0", "body-parser": "^2.2.0", @@ -2229,6 +2231,7 @@ "version": "8.5.1", "resolved": "https://registry.npmmirror.com/express-jwt/-/express-jwt-8.5.1.tgz", "integrity": "sha512-Dv6QjDLpR2jmdb8M6XQXiCcpEom7mK8TOqnr0/TngDKsG2DHVkO8+XnVxkJVN7BuS1I3OrGw6N8j5DaaGgkDRQ==", + "peer": true, "dependencies": { "@types/jsonwebtoken": "^9", "express-unless": "^2.1.3", @@ -2260,12 +2263,14 @@ "node_modules/express-session/node_modules/cookie-signature": { "version": "1.0.7", "resolved": "https://registry.npmmirror.com/cookie-signature/-/cookie-signature-1.0.7.tgz", - "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==" + "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==", + "peer": true }, "node_modules/express-session/node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "peer": true, "dependencies": { "ms": "2.0.0" } @@ -2273,12 +2278,14 @@ "node_modules/express-session/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "peer": true }, "node_modules/express-unless": { "version": "2.1.3", "resolved": "https://registry.npmmirror.com/express-unless/-/express-unless-2.1.3.tgz", - "integrity": "sha512-wj4tLMyCVYuIIKHGt0FhCtIViBcwzWejX0EjNxveAa6dG+0XBCQhMbx+PnkLkFCxLC69qoFrxds4pIyL88inaQ==" + "integrity": "sha512-wj4tLMyCVYuIIKHGt0FhCtIViBcwzWejX0EjNxveAa6dG+0XBCQhMbx+PnkLkFCxLC69qoFrxds4pIyL88inaQ==", + "peer": true }, "node_modules/express/node_modules/debug": { "version": "4.4.3", @@ -2706,6 +2713,7 @@ "version": "5.4.24", "resolved": "https://registry.npmmirror.com/grant/-/grant-5.4.24.tgz", "integrity": "sha512-PD5AvSI7wgCBDi2mEd6M/TIe+70c/fVc3Ik4B0s4mloWTy9J800eUEcxivOiyqSP9wvBy2QjWq1JR8gOfDMnEg==", + "peer": true, "dependencies": { "qs": "^6.14.0", "request-compose": "^2.1.7", @@ -2765,6 +2773,7 @@ "resolved": "https://registry.npmmirror.com/hash.js/-/hash.js-1.1.7.tgz", "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", "optional": true, + "peer": true, "dependencies": { "inherits": "^2.0.3", "minimalistic-assert": "^1.0.1" @@ -2795,6 +2804,7 @@ "resolved": "https://registry.npmmirror.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz", "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", "optional": true, + "peer": true, "dependencies": { "hash.js": "^1.0.3", "minimalistic-assert": "^1.0.0", @@ -3079,6 +3089,7 @@ "version": "9.0.2", "resolved": "https://registry.npmmirror.com/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "peer": true, "dependencies": { "jws": "^3.2.2", "lodash.includes": "^4.3.0", @@ -3100,6 +3111,7 @@ "version": "1.4.1", "resolved": "https://registry.npmmirror.com/jwa/-/jwa-1.4.1.tgz", "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "peer": true, "dependencies": { "buffer-equal-constant-time": "1.0.1", "ecdsa-sig-formatter": "1.0.11", @@ -3110,6 +3122,7 @@ "version": "3.2.2", "resolved": "https://registry.npmmirror.com/jws/-/jws-3.2.2.tgz", "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "peer": true, "dependencies": { "jwa": "^1.4.1", "safe-buffer": "^5.0.1" @@ -3120,6 +3133,7 @@ "resolved": "https://registry.npmmirror.com/jwa/-/jwa-2.0.0.tgz", "integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", "optional": true, + "peer": true, "dependencies": { "buffer-equal-constant-time": "1.0.1", "ecdsa-sig-formatter": "1.0.11", @@ -3131,6 +3145,7 @@ "resolved": "https://registry.npmmirror.com/jwk-to-pem/-/jwk-to-pem-2.0.7.tgz", "integrity": "sha512-cSVphrmWr6reVchuKQZdfSs4U9c5Y4hwZggPoz6cbVnTpAVgGRpEuQng86IyqLeGZlhTh+c4MAreB6KbdQDKHQ==", "optional": true, + "peer": true, "dependencies": { "asn1.js": "^5.3.0", "elliptic": "^6.6.1", @@ -3142,6 +3157,7 @@ "resolved": "https://registry.npmmirror.com/jws/-/jws-4.0.0.tgz", "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", "optional": true, + "peer": true, "dependencies": { "jwa": "^2.0.0", "safe-buffer": "^5.0.1" @@ -3191,7 +3207,8 @@ "node_modules/lodash.includes": { "version": "4.3.0", "resolved": "https://registry.npmmirror.com/lodash.includes/-/lodash.includes-4.3.0.tgz", - "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", + "peer": true }, "node_modules/lodash.isarguments": { "version": "3.1.0", @@ -3201,32 +3218,38 @@ "node_modules/lodash.isboolean": { "version": "3.0.3", "resolved": "https://registry.npmmirror.com/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", - "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==" + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", + "peer": true }, "node_modules/lodash.isinteger": { "version": "4.0.4", "resolved": "https://registry.npmmirror.com/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", - "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==" + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", + "peer": true }, "node_modules/lodash.isnumber": { "version": "3.0.3", "resolved": "https://registry.npmmirror.com/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", - "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==" + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", + "peer": true }, "node_modules/lodash.isplainobject": { "version": "4.0.6", "resolved": "https://registry.npmmirror.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==" + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "peer": true }, "node_modules/lodash.isstring": { "version": "4.0.1", "resolved": "https://registry.npmmirror.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", + "peer": true }, "node_modules/lodash.once": { "version": "4.1.1", "resolved": "https://registry.npmmirror.com/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", + "peer": true }, "node_modules/log-symbols": { "version": "4.1.0", @@ -3339,13 +3362,15 @@ "version": "1.0.1", "resolved": "https://registry.npmmirror.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "optional": true + "optional": true, + "peer": true }, "node_modules/minimalistic-crypto-utils": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==", - "optional": true + "optional": true, + "peer": true }, "node_modules/minimatch": { "version": "5.0.1", @@ -3729,6 +3754,7 @@ "version": "0.9.0", "resolved": "https://registry.npmmirror.com/oauth-sign/-/oauth-sign-0.9.0.tgz", "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "peer": true, "engines": { "node": "*" } @@ -3768,6 +3794,7 @@ "version": "1.0.2", "resolved": "https://registry.npmmirror.com/on-headers/-/on-headers-1.0.2.tgz", "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", + "peer": true, "engines": { "node": ">= 0.8" } @@ -3974,6 +4001,7 @@ "version": "1.0.0", "resolved": "https://registry.npmmirror.com/random-bytes/-/random-bytes-1.0.0.tgz", "integrity": "sha512-iv7LhNVO047HzYR3InF6pUcUsPQiHTM1Qal51DcGSuZFBil1aBBWG5eHPNek7bvILMaYJ/8RU1e8w1AMdHmLQQ==", + "peer": true, "engines": { "node": ">= 0.8" } @@ -4106,6 +4134,7 @@ "version": "2.1.7", "resolved": "https://registry.npmmirror.com/request-compose/-/request-compose-2.1.7.tgz", "integrity": "sha512-27amNkWTK4Qq25XEwdmrhb4VLMiQzRSKuDfsy1o1griykcyXk5MxMHmJG+OKTRdO9PgsO7Kkn7GrEkq0UAIIMQ==", + "peer": true, "engines": { "node": ">=12.0.0" } @@ -4114,6 +4143,7 @@ "version": "1.0.1", "resolved": "https://registry.npmmirror.com/request-oauth/-/request-oauth-1.0.1.tgz", "integrity": "sha512-85THTg1RgOYtqQw42JON6AqvHLptlj1biw265Tsq4fD4cPdUvhDB2Qh9NTv17yCD322ROuO9aOmpc4GyayGVBA==", + "peer": true, "dependencies": { "oauth-sign": "^0.9.0", "qs": "^6.9.6", @@ -4880,6 +4910,7 @@ "version": "2.1.5", "resolved": "https://registry.npmmirror.com/uid-safe/-/uid-safe-2.1.5.tgz", "integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==", + "peer": true, "dependencies": { "random-bytes": "~1.0.0" }, @@ -4933,6 +4964,7 @@ "version": "8.3.2", "resolved": "https://registry.npmmirror.com/uuid/-/uuid-8.3.2.tgz", "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "peer": true, "bin": { "uuid": "dist/bin/uuid" } diff --git a/src/XNetEventKeys.ts b/src/XNetEventKeys.ts index 9286298..fedab11 100644 --- a/src/XNetEventKeys.ts +++ b/src/XNetEventKeys.ts @@ -1,183 +1,202 @@ - /** * 子报文类型(msgType)列表 */ export class XNetEventKeys { + //服务端报文,这里改动,服务端也要改动 + /******************** SERVER_EVENT_KEYS ********************/ - //服务端报文,这里改动,服务端也要改动 - /******************** SERVER_EVENT_KEYS ********************/ - /** - * 登录 - */ - public static readonly LOGIN = 0x0001 + /** + * 客户端订阅实例 + */ + public static readonly SUBSCRIBE_ROOM = 0x0000; + /** + * 登录 + */ + public static readonly LOGIN = 0x0001; - /** - * 房间群发信息 - */ - public static readonly ROOM_MSG = 0x0002 + /** + * 房间群发信息 + */ + public static readonly ROOM_MSG = 0x0002; - /** - * 房间群发信息,自己不接收 - */ - public static readonly ROOM_MSG_OTHER = 0x0003 - /******************** SERVER_EVENT_KEYS ********************/ + /** + * 房间群发信息,自己不接收 + */ + public static readonly ROOM_MSG_OTHER = 0x0003; + /******************** SERVER_EVENT_KEYS ********************/ - /// - /// 用户下线 - /// - public static readonly OFFLINE = 0x0004; + /// + /// 用户下线 + /// + public static readonly OFFLINE = 0x0004; - /// - /// 用户做主机 - /// - public static readonly HOST = 0x0005; + /// + /// 用户做主机 + /// + public static readonly HOST = 0x0005; - /// - /// 本局游戏结束 - /// - public static readonly GAME_END = 0x0006; + /// + /// 本局游戏结束 + /// + public static readonly GAME_END = 0x0006; - /// - /// 心跳包请求 - /// - public static readonly HEART_BEAT = 0x0007; + /// + /// 心跳包请求 + /// + public static readonly HEART_BEAT = 0x0007; - /// - /// 心跳包响应 - /// - public static readonly HEART_BEAT_REPLY = 0x0008; + /// + /// 心跳包响应 + /// + public static readonly HEART_BEAT_REPLY = 0x0008; + /** + * 加入或者创建房间 + */ + public static readonly CREATE_OR_JOIN_ROOM = 0x0009; + /** + * 个人私有的消息 + */ + public static readonly PRIVATGE = 0x0010; - /** - * 加入或者创建房间 - */ - public static readonly CREATE_OR_JOIN_ROOM = 0x0009 - /** - * 个人私有的消息 - */ - public static readonly PRIVATGE = 0x0010 + /** + * 添加AI玩家 + */ + public static readonly ADD_AI_PLAYER = 0x0011; - /** - * 添加AI玩家 - */ - public static readonly ADD_AI_PLAYER = 0x0011 + /** + * 删除所有AI + */ + public static readonly DELETE_ALL_AI_PLAYER = 0x0012; - /** - * 删除所有AI - */ - public static readonly DELETE_ALL_AI_PLAYER = 0x0012 + /** + * 发送给自己的消息 + */ + public static readonly TO_SELF = 0x0013; - /** - * 发送给自己的消息 - */ - public static readonly TO_SELF = 0x0013 + /** + * 公开或者关闭房间 + */ + public static readonly ENABLE_ROOM_PUBLIC = 0x0014; - /** - * 公开或者关闭房间 - */ - public static readonly ENABLE_ROOM_PUBLIC = 0x0014 + /** + * 启用或者关闭AI + */ + public static readonly ENABLE_AI = 0x0015; - /** - * 启用或者关闭AI - */ - public static readonly ENABLE_AI = 0x0015 + /** + * 游戏将要结束,改变倒计时文字为闪烁或红色 + */ + public static readonly GAME_WILLOVER = 0x0016; - /** - * 游戏将要结束,改变倒计时文字为闪烁或红色 - */ - public static readonly GAME_WILLOVER = 0x0016 + /** + * 本局游戏将要结束 + */ + public static readonly GAME_WILL_END = 0x0017; - /// - /// 本局游戏将要结束 - /// - public static readonly GAME_WILL_END = 0x0017; + /** + * Agent位置角度同步消息 + */ + public static readonly AGENT_LOCATION_SYNC = 0x0018; - //客户端报文 - /******************** CLIENT_EVENT_KEYS ********************/ - /** - * 添加玩家 - */ - public static readonly ADD_OR_UPDATE_PLAYER = 0x1004 + /** + * Agent角度同步消息 + */ + public static readonly AGENT_ROTATION_SYNC = 0x0019; - /** - * 玩家移动 - */ - public static readonly SYNC_POS_ROT = 0x1005 + /** + * 用户上线 + */ + public static readonly ONLINE = 0x0020; - /** - * 玩家组移动 - */ - public static readonly SYNC_POS_ROT_ARR = 0x1006 + //客户端报文 + /******************** CLIENT_EVENT_KEYS ********************/ + /** + * 添加玩家 + */ + public static readonly ADD_OR_UPDATE_PLAYER = 0x1004; - /** - * 玩家发射炮弹 - */ - public static readonly SYNC_SHOT = 0x1007 + /** + * 玩家移动 + */ + public static readonly SYNC_POS_ROT = 0x1005; - /** - * 玩家收到被击中信息 - */ - public static readonly SYNC_HIT = 0x1008 + /** + * 玩家组移动 + */ + public static readonly SYNC_POS_ROT_ARR = 0x1006; - /** - * 玩家收到被击毁信息 - */ - public static readonly BOOM = 0x1009 + /** + * 玩家发射炮弹 + */ + public static readonly SYNC_SHOT = 0x1007; - /** - * 玩家收到重生信息 - */ - public static readonly REBORN = 0x1010 + /** + * 玩家收到被击中信息 + */ + public static readonly SYNC_HIT = 0x1008; + /** + * 玩家收到被击毁信息 + */ + public static readonly BOOM = 0x1009; - /** - * 玩家请求导航点信息或者初始化 - */ - public static readonly REQUEST_PATH = 0x1011 + /** + * 玩家收到重生信息 + */ + public static readonly REBORN = 0x1010; - /** - * 锁定对象信息 - */ - public static readonly LOCK_TARGET = 0x1012 + /** + * 玩家请求导航点信息或者初始化 + */ + public static readonly REQUEST_PATH = 0x1011; - /** - * 设置玩家坐标点,欧拉角位置信息,并解锁服务端移动 - */ - public static readonly LOCATION = 0x1013 + /** + * 锁定对象信息 + */ + public static readonly LOCK_TARGET = 0x1012; - /** - * 玩家或者AI请求初始化 - */ - public static readonly REQUEST_INIT = 0x1014 + /** + * 设置玩家坐标点,欧拉角位置信息,并解锁服务端移动 + */ + public static readonly LOCATION = 0x1013; - /** - * 开局信息,收到后开始读取地图 - */ - public static readonly START_LOAD_MAP = 0x1015 - /** - * 更改房间MapKey 和 Name - */ - public static readonly CHANGE_ROOM_KEY_NAME = 0x1016 - /** - * 玩家进入地图场景 - */ - public static readonly PLAYER_ENTER_MAP = 0x1017 + /** + * 玩家或者AI请求初始化 + */ + public static readonly REQUEST_INIT = 0x1014; + /** + * 开局信息,收到后开始读取地图 + */ + public static readonly START_LOAD_MAP = 0x1015; + /** + * 更改房间MapKey 和 Name + */ + public static readonly CHANGE_ROOM_KEY_NAME = 0x1016; + /** + * 玩家进入地图场景 + */ + public static readonly PLAYER_ENTER_MAP = 0x1017; - /** - * 获取小于等于指定人数的房间 - */ - public static readonly GET_ROOM_FOR_COUNT = 0x1018 + /** + * 获取小于等于指定人数的房间 + */ + public static readonly GET_ROOM_FOR_COUNT = 0x1018; - /** - * 获取开始游戏的房间 - */ - public static readonly GET_ROOM_FOR_START = 0x1019 + /** + * 获取开始游戏的房间 + */ + public static readonly GET_ROOM_FOR_START = 0x1019; - /** - * 获取到 LOBBY_ROOM 普通消息 - */ - public static readonly GET_LOBBY_ROOM_MESSAGE = 0x1020 - /******************** CLIENT_EVENT_KEYS ********************/ + /** + * 获取到 LOBBY_ROOM 普通消息 + */ + public static readonly GET_LOBBY_ROOM_MESSAGE = 0x1020; -} \ No newline at end of file + /** + * 退出当前所在的房间 + */ + public static readonly LEAVE_ROOM = 0x1021; + /******************** CLIENT_EVENT_KEYS ********************/ +} diff --git a/src/manager/PlayerManager.ts b/src/manager/PlayerManager.ts index 20cf694..bf43afe 100644 --- a/src/manager/PlayerManager.ts +++ b/src/manager/PlayerManager.ts @@ -477,17 +477,7 @@ export class PlayerManager { * @param client 当前登录客户Client */ private checkLoginAndCreateHostAI(room: Room, mapKey: string, client: Client, message: any): number { - // let enterMapPlayerCount = 0 - // let loginPlayerCount = 0 - // state.players.forEach((player) => { - // if (enterMapPlayerCount < 2 && player.isEnterMap) { - // enterMapPlayerCount++ - // } - // if (loginPlayerCount < 2 && player.isLogined) { - // loginPlayerCount++ - // } - // }) - // const isFirstLogin = loginPlayerCount === 1 + const state = room.state as RoomState const isFirstPlayer = state.host == null let hasAI = false @@ -497,23 +487,16 @@ export class PlayerManager { return } }) - // console.log("isFirstPlayer:", isFirstPlayer) if (isFirstPlayer) { if (state.players.has(client.sessionId)) { //判空,第一个用户建主 state.host = state.players.get(client.sessionId) - // if (state.host.isEnterMap) { - // return - // } state.birthPositions.clear() for (let i = 0; i < message.birthPositions.length; i++) { const loc = new Location() CalcTool.setXYZ(loc, message.birthPositions[i]) state.birthPositions.push(loc) } - - // console.log("hasAI:", hasAI) - // console.log("message.hasAI:", message.hasAI) if (!hasAI && message.hasAI) { for (let i = 0; i < Global.aiCount; i++) { const aiPlayer = new RoomSignaleState() @@ -547,7 +530,7 @@ export class PlayerManager { } this.requestInitPlayer(room, mapKey, client, room.clients, deviceMessage) - // if (message.isAI) { + //可以移动了 SceneManager.Instance.setPlayerIsCanControl(room.roomId, aiPlayer.playerId, true, {}) //开始无敌 @@ -557,27 +540,9 @@ export class PlayerManager { setTimeout(() => { SceneManager.Instance.setPlayerIsCanHit(room.roomId, aiPlayer.playerId, true) }, 5000); - // // state.players.set(aiPlayer.playerId, aiPlayer) - // //向其他玩家发送AI的信息 - // room.broadcast(XNetEventKeys.PRIVATGE, { - // msgType: XNetEventKeys.ADD_AI_PLAYER, - // playerId: aiPlayer.playerId, - // isAI: aiPlayer.isAI, - // bodyIdx: bodyIdx, - // weaponIdx: weaponIdx, - // armorIdx: armorIdx, - // chassisIdx: chassisIdx, - // }) } } } - - // // console.log("让主机创建AI") - // client.send(XNetEventKeys.PRIVATGE, { - // msgType: XNetEventKeys.HOST, - // createAICount: state.aiInitCount - // }) - // //创建AI } if (state.players.has(client.sessionId)) { @@ -585,13 +550,6 @@ export class PlayerManager { return loginPlayer.maxBlood } return 0 - // else { - // if (this.clients.length === 1) { - // client.send(XNetEventKeys.PRIVATGE, { - // msgType: XNetEventKeys.HOST - // }) - // } - // } } private offlineOldSameClientPlayer(room: Room, playerId: string) {