From a0f27a8294b6fbbf666f68ec0ca3983f3823bce9 Mon Sep 17 00:00:00 2001 From: azw Date: Wed, 8 Nov 2023 10:05:51 +0000 Subject: [PATCH] 1 --- server/tools/robot/kcpclient/app.js | 8 + server/tools/robot/kcpclient/clientnet.js | 222 ++ .../tools/robot/kcpclient/package-lock.json | 382 ++++ server/tools/robot/kcpclient/package.json | 13 + .../robot/kcpclient/proto/cs_msgid.proto | 71 + .../robot/kcpclient/proto/cs_proto.proto | 1904 +++++++++++++++++ server/tools/robot/kcpclient/proto/mt.proto | 665 ++++++ .../tools/robot/kcpclient/proto/navmesh.proto | 29 + .../robot/kcpclient/proto/out/cs_msgid.proto | 61 + .../robot/kcpclient/proto/out/cs_proto.proto | 1157 ++++++++++ .../robot/kcpclient/proto/out/metatable.proto | 556 +++++ .../robot/kcpclient/proto/out/ss_msgid.proto | 13 + .../robot/kcpclient/proto/out/ss_proto.proto | 35 + .../robot/kcpclient/proto/ss_msgid.proto | 14 + .../robot/kcpclient/proto/ss_proto.proto | 35 + server/tools/robot/kcpclient/testcase.js | 91 + 16 files changed, 5256 insertions(+) create mode 100644 server/tools/robot/kcpclient/app.js create mode 100644 server/tools/robot/kcpclient/clientnet.js create mode 100644 server/tools/robot/kcpclient/package-lock.json create mode 100644 server/tools/robot/kcpclient/package.json create mode 100644 server/tools/robot/kcpclient/proto/cs_msgid.proto create mode 100755 server/tools/robot/kcpclient/proto/cs_proto.proto create mode 100755 server/tools/robot/kcpclient/proto/mt.proto create mode 100644 server/tools/robot/kcpclient/proto/navmesh.proto create mode 100644 server/tools/robot/kcpclient/proto/out/cs_msgid.proto create mode 100644 server/tools/robot/kcpclient/proto/out/cs_proto.proto create mode 100644 server/tools/robot/kcpclient/proto/out/metatable.proto create mode 100644 server/tools/robot/kcpclient/proto/out/ss_msgid.proto create mode 100644 server/tools/robot/kcpclient/proto/out/ss_proto.proto create mode 100644 server/tools/robot/kcpclient/proto/ss_msgid.proto create mode 100755 server/tools/robot/kcpclient/proto/ss_proto.proto create mode 100644 server/tools/robot/kcpclient/testcase.js diff --git a/server/tools/robot/kcpclient/app.js b/server/tools/robot/kcpclient/app.js new file mode 100644 index 00000000..9ee07f94 --- /dev/null +++ b/server/tools/robot/kcpclient/app.js @@ -0,0 +1,8 @@ +const TestCase = require('./testcase'); + +async function start() { + const testCase = new TestCase(); + await testCase.init(); +} + +start(); diff --git a/server/tools/robot/kcpclient/clientnet.js b/server/tools/robot/kcpclient/clientnet.js new file mode 100644 index 00000000..85bf5b62 --- /dev/null +++ b/server/tools/robot/kcpclient/clientnet.js @@ -0,0 +1,222 @@ +const protobuf = require('protobufjs'); +const kcp = require('./node_modules/node-kcp/build/Release/kcp'); +const dgram = require('dgram'); +const ws = require('nodejs-websocket'); + +const update_interval = 10; + +function prettyJsonEncode(obj) { + return JSON.stringify(obj, "", " "); +} + +class ClientNet { + + constructor(url, protoPbFile, msgIdPbFile) { + this.url = url; + this.wsConn = null; + this.conn = null; + this.protoPbFile = protoPbFile; + this.msgIdPbFile = msgIdPbFile; + this.protoPb = null; + this.msgIdPb = null; + this.cmMsgId = null; + this.smMsgId = null; + this.recvBuf = Buffer.alloc(0); + this.uniqId = 1000; + this.msgHandlerMap = new Map(); + this.kcpObj = new kcp.KCP(123, + { + 'address': '192.168.100.45', + 'port': 17602 + }); + this.kcpObj.stream(1); + this.conn = dgram.createSocket('udp4'); + + this.kcpObj.nodelay(0, 0, 0, 0); + this.kcpObj.output((data, size, context) => { + console.log('kcp output', data, size, context); + this.conn.send(data, 0, size, context.port, context.address); + }); + + this.conn.on('error', (err) => { + console.log('client error:' + err); + }); + this.conn.on('message', (msg, rinfo) => { + console.log('message', msg, msg.length); + this.kcpObj.input(msg); + const recv = this.kcpObj.recv(); + if (recv) { + console.log('recv', recv, recv.length); + } + }); + + setInterval(() => { + this.kcpObj.update(Date.now()); + }, update_interval); + + } + + selfRegisterMsgHandle(msgName) { + this.registerMsgHandle( + msgName, + (msg) => { + this[msgName](msg); + }); + } + + async init() { + { + this.protoPb = await (new protobuf.Root()).load(this.protoPbFile, + { + 'keepCase': true + } + ); + } + { + this.msgIdPb = await (new protobuf.Root()).load(this.msgIdPbFile, + { + 'keepCase': true + } + ); + this.cmMsgId = this.msgIdPb.lookup('CMMessageId_e'); + this.smMsgId = this.msgIdPb.lookup('SMMessageId_e'); + } + { + //this.selfRegisterMsgHandle('SMLogin'); + } + } + + async connect() { + this.wsConn = await ws.connect(this.url); + this.on('binary', this.#onReceive.bind(this)); + } + + on(eventName, ...args) { + this.conn.on(eventName, ...args); + } + + async #onReceive(inStream) { + inStream.on('readable', async () => { + //console.log('inStream.readable'); + const newData = inStream.read(); + if (newData) { + this.recvBuf = Buffer.concat([this.recvBuf, newData]); + await this.#onParsePacket(); + } + }); + inStream.on('end', () => { + //console.log('inStream.end', this.recvBuf.length); + }); + inStream.on('close', () => { + //console.log('inStream.close'); + }); + } + + async #onParsePacket() { + let offset = 0; + while (this.recvBuf.length > offset + 12) { + const msgSize = this.recvBuf.readUInt32LE(offset + 0); + const msgId = this.recvBuf.readUInt16LE(offset + 4); + const magicCode = this.recvBuf.readUInt16LE(offset + 6); + const seqId = this.recvBuf.readUInt32LE(offset + 8); + if (this.recvBuf.length >= offset + 12 + msgSize) { + await this.#processMsg(msgId, + this.recvBuf.slice + ( + offset + 12, + offset + 12 + msgSize) + ); + offset += 12 + msgSize; + } else { + break; + } + } + this.recvBuf = this.recvBuf.slice(offset); + } + + async #processMsg(msgId, buff) { + const handlers = this.msgHandlerMap.get(msgId); + if (handlers) { + let msg = null; + handlers.forEach((value, key) => { + if (!msg) { + msg = value.msgType.decode(buff); + } + console.log(value.msgType['name'], prettyJsonEncode(msg)); + value.cb(msg); + }); + } + } + + registerMsgHandle(msgName, cb) { + const msgType = this.protoPb.lookupType(msgName); + const msgId = this.smMsgId.values['_' + msgName]; + if (!msgId) { + return null; + } + const handle = { + msgId: msgId, + msgName: msgName, + msgType: msgType, + cb: cb, + uniqId: ++this.uniqId} + ; + if (!this.msgHandlerMap.has(msgId)) { + this.msgHandlerMap.set(msgId, new Map([ + [handle.uniqId, handle] + ])); + } else { + this.msgHandlerMap.get(msgId).set(handle.uniqId, handle); + } + return handle; + } + + unRegisterMsgHandle(handle) { + if (this.msgHandlerMap.has(handle.msgId)) { + if (this.msgHandlerMap[handle.msgId].has(handle.uniqId)) { + this.msgHandlerMap[handle.msgId].delete(handle.uniqId); + } + } + } + + async sendMsg(name, msg) { + const msgType = this.protoPb.lookupType(name); + const msgId = this.cmMsgId.values['_' + name]; + const msgPb = msgType.create(msg); + + const msgBuf = msgType.encode(msg).finish(); + let buf = Buffer.alloc(12); + buf.writeUInt16LE(msgBuf.length, 0); + buf.writeUInt16LE(msgId, 2); + buf.writeInt32LE(0, 4); + buf.writeUInt8('K'.charCodeAt(0), 8); + buf.writeUInt8('S'.charCodeAt(0), 9); + buf.writeInt16LE(0, 10); + + const buff = Buffer.concat([buf, msgBuf]); + this.kcpObj.send(buff, buff.length); + console.log(name, msg, buff.length); + } + + async sendWsMsg(name, msg) { + const msgType = this.protoPb.lookupType(name); + const msgId = this.cmMsgId.values['_' + name]; + const msgPb = msgType.create(msg); + + const msgBuf = msgType.encode(msg).finish(); + let buf = Buffer.alloc(12); + buf.writeUInt16LE(msgBuf.length, 0); + buf.writeUInt16LE(msgId, 2); + buf.writeInt32LE(0, 4); + buf.writeUInt8('K'.charCodeAt(0), 8); + buf.writeUInt8('S'.charCodeAt(0), 9); + buf.writeInt16LE(0, 10); + + const buff = Buffer.concat([buf, msgBuf]); + this.kcpObj.send(buff, buff.length); + console.log(name, msg, buff.length); + } + +} + +module.exports = ClientNet; diff --git a/server/tools/robot/kcpclient/package-lock.json b/server/tools/robot/kcpclient/package-lock.json new file mode 100644 index 00000000..2f25246f --- /dev/null +++ b/server/tools/robot/kcpclient/package-lock.json @@ -0,0 +1,382 @@ +{ + "name": "kcpclient", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "kcpclient", + "version": "1.0.0", + "dependencies": { + "axios": "^0.27.0", + "node-kcp": "^1.0.13", + "nodejs-websocket": "^1.7.2", + "protobufjs": "^6.11.2" + } + }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "dependencies": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" + }, + "node_modules/@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" + }, + "node_modules/@types/long": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", + "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==" + }, + "node_modules/@types/node": { + "version": "18.15.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz", + "integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==" + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "dependencies": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/long": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/nan": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", + "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==" + }, + "node_modules/node-kcp": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/node-kcp/-/node-kcp-1.0.13.tgz", + "integrity": "sha512-oZS++zheKSkcNLlvKZvCv5QEp60sRdCKHV96/V+tFCkeGcjbwkNBBIRvonSIyOLHKs2/E9A2zPVulsgHdoTnWA==", + "hasInstallScript": true, + "dependencies": { + "nan": "^2.16.0" + } + }, + "node_modules/nodejs-websocket": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/nodejs-websocket/-/nodejs-websocket-1.7.2.tgz", + "integrity": "sha512-PFX6ypJcCNDs7obRellR0DGTebfUhw1SXGKe2zpB+Ng1DQJhdzbzx1ob+AvJCLzy2TJF4r8cCDqMQqei1CZdPQ==", + "engines": { + "node": ">=4" + } + }, + "node_modules/protobufjs": { + "version": "6.11.3", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.3.tgz", + "integrity": "sha512-xL96WDdCZYdU7Slin569tFX712BxsxslWwAfAhCYjQKGTq7dAU91Lomy6nLLhh/dyGhk/YH4TwTSRxTzhuHyZg==", + "hasInstallScript": true, + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/long": "^4.0.1", + "@types/node": ">=13.7.0", + "long": "^4.0.0" + }, + "bin": { + "pbjs": "bin/pbjs", + "pbts": "bin/pbts" + } + } + }, + "dependencies": { + "@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" + }, + "@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" + }, + "@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" + }, + "@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" + }, + "@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "requires": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" + }, + "@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" + }, + "@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" + }, + "@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" + }, + "@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" + }, + "@types/long": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", + "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==" + }, + "@types/node": { + "version": "18.15.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz", + "integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "requires": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "long": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" + }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, + "nan": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", + "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==" + }, + "node-kcp": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/node-kcp/-/node-kcp-1.0.13.tgz", + "integrity": "sha512-oZS++zheKSkcNLlvKZvCv5QEp60sRdCKHV96/V+tFCkeGcjbwkNBBIRvonSIyOLHKs2/E9A2zPVulsgHdoTnWA==", + "requires": { + "nan": "^2.16.0" + } + }, + "nodejs-websocket": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/nodejs-websocket/-/nodejs-websocket-1.7.2.tgz", + "integrity": "sha512-PFX6ypJcCNDs7obRellR0DGTebfUhw1SXGKe2zpB+Ng1DQJhdzbzx1ob+AvJCLzy2TJF4r8cCDqMQqei1CZdPQ==" + }, + "protobufjs": { + "version": "6.11.3", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.3.tgz", + "integrity": "sha512-xL96WDdCZYdU7Slin569tFX712BxsxslWwAfAhCYjQKGTq7dAU91Lomy6nLLhh/dyGhk/YH4TwTSRxTzhuHyZg==", + "requires": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/long": "^4.0.1", + "@types/node": ">=13.7.0", + "long": "^4.0.0" + } + } + } +} diff --git a/server/tools/robot/kcpclient/package.json b/server/tools/robot/kcpclient/package.json new file mode 100644 index 00000000..6c04440b --- /dev/null +++ b/server/tools/robot/kcpclient/package.json @@ -0,0 +1,13 @@ +{ + "name": "kcpclient", + "version": "1.0.0", + "description": "", + "private": true, + "scripts": {}, + "dependencies": { + "axios": "^0.27.0", + "node-kcp": "^1.0.13", + "nodejs-websocket": "^1.7.2", + "protobufjs": "^6.11.2" + } +} diff --git a/server/tools/robot/kcpclient/proto/cs_msgid.proto b/server/tools/robot/kcpclient/proto/cs_msgid.proto new file mode 100644 index 00000000..999c6341 --- /dev/null +++ b/server/tools/robot/kcpclient/proto/cs_msgid.proto @@ -0,0 +1,71 @@ +package cs; + +//消息id定义 +enum CMMessageId_e +{ + _CMKcpHandshake = 99; + _CMPing = 101; + + _CMJoin = 103; + _CMReconnect = 104; + _CMMove = 201; + _CMEmote = 204; + _CMVoice = 206; + _CMGameOver = 207; + _CMWatchWar = 208; + _CMLeave = 209; + _CMRevive = 210; + _CMCancelRevive = 211; + _CMExecCommand = 217; + _CMMatchCancel = 218; + _CMMatchChoose = 219; + _CMMatchStartGame = 220; + _CMMatchCancelStartGame = 221; + _CMMatchSendMsg = 222; + _CMMatchBroadcastMsg = 223; + _CMRequestBulletDmg = 230; + _CMStowShield = 231; + _CMImmediateMsg = 232; + _CMTeamMarkTargetPos = 233; + _CMRequestThrowDmg = 236; + _CMSetRevivePosition = 237; + _CMGetSettlementTeamList = 238; +} + +enum SMMessageId_e +{ + _SMKcpHandshake = 99; + _SMPing = 101; + _SMRpcError = 102; + _SMReconnect = 104; + + _SMWatchWar = 208; + _SMLeave = 209; + _SMMatchCancel = 218; + _SMGetSettlementTeamList = 238; + + _SMJoinedNotify = 103; + _SMMapInfo = 1002; + _SMUpdate = 1004; + _SMRollMsg = 1005; + _SMVoiceNotify = 1007; + _SMDisconnectNotify = 1008; + _SMGameOver = 1009; + _SMDebugMsg = 1010; + _SMUiUpdate = 1012; + _SMGameStart = 1013; + _SMSysPiaoMsg = 1014; + _SMShowCountdown = 1015; + _SMShowTeamUI = 1016; + _SMUpdateMatchInfo = 1017; + _SMGetItemNotify = 1018; + _SMMatchMemberMsgNotify = 1019; + _SMPvePassWave = 1020; + _SMTeamMarkTargetPosList = 1021; + _SMDebugCmd = 1022; + _SMNewBieEnd = 1023; + _SMNewsTicker = 1024; + _SMSyncPosition = 1025; + _SMSyncTeamData = 1026; + _SMSyncKillList = 1027; +} diff --git a/server/tools/robot/kcpclient/proto/cs_proto.proto b/server/tools/robot/kcpclient/proto/cs_proto.proto new file mode 100755 index 00000000..29806279 --- /dev/null +++ b/server/tools/robot/kcpclient/proto/cs_proto.proto @@ -0,0 +1,1904 @@ +package cs; + +/* + 约定: + CM前缀:客户端发给服务器的消息(client message) + SM前缀:服务器发给客户的的消息(server message) + MF前缀:消息的内嵌字段,只能作为其他消息的内嵌字段不能send(message field) + _e后缀:枚举类型 + _uniid后缀:唯一id + union_前缀:联合体 + _前缀:该字段仅服务器使用客户端无需处理 + + 网络包格式:msghead + msgbody + msghead: packagelen + msgid + seqid + magiccode + reserved = 2 + 2 + 4 + 2 + 2 = 12字节 + msgbody: protobuf数据 + msghead说明 + packagelen(unsigned short): 双字节网络包长度, + msgid(unsigned short): 双字节消息id + seqid(unsigned int): 4字节序号id + magiccode(unsigned short): 2字节魔数,并且为固定常数KS,占位符客户端不需什么处理 + reserved(unsigned short): 保留 + + 十六进制位运算数据表示法 + 0x01 == 1<<0 + 0x02 == 1<<1 + 0x04 == 1<<2 + + data_flags字段的意义 + 由于protobuf的二义性无法描述repeated字段是否有值(非repeated的字段可以通过msg.xxx == null来a判断) + 所以给协议添加了data_flags这样的字段用来描述字段是否有值 + data_flags32:描述id 1-31的字段哪些是赋值 + data_flags64: 描述id 31-63直接的字段是否赋值 + data_flags128...... 以此类推 + message MFRoleInfo + { + optional int32 role_id = 1; + optional int32 role_name = 2; + + optional int32 role_level = 34; + + optional uint32 data_flags32 = 256; + optional uint32 data_flags64 = 257; + } + role_id是否赋值 (data_flags32 & (1<<(1 - 1))) != 0 + role_name是否赋值 (data_flags32 & (1<<(2 - 1))) != 0 + role_level是否赋值 (data_flags64 & (1<<(34 - 33)) != 0 + 客户端可以根据protobuf反射得到字段名和字段id的对应关系做到自动化判断 +*/ + +//常量 +enum Constant_e +{ + ProtoVersion = 2023090601; //系统版本 +} + +//心跳 +message CMPing +{ +} +message SMPing +{ + optional int32 param1 = 1; + optional int32 source = 2 [default = 0]; //0:tcp 1:udp +} + +//kcp握手 +message CMKcpHandshake +{ + optional int32 proto_version = 1; //协议版本号Constant_e.ProtoVersion + optional string account_id = 2; //账号id + optional string session_id = 3; //session id + optional string team_uuid = 4; //保留 + optional int32 secret_key_place = 5; //私钥存放位置 0:存在用户协议前(老) 1:存在kcp底层协议头之后(新) +} + +message SMKcpHandshake +{ + optional int32 errcode = 1; //errcode != 0时表示不支持kcp + optional string errmsg = 2; //errmsg + optional int32 conv = 3; //用来作为客户端的conv + optional bytes secret_key = 4; //secret key客户端每次上报的时候加在包头之前 + optional string remote_host = 5; //host + optional int32 remote_port = 6; //port +} + +//rpc调用错误 +message SMRpcError +{ + optional int32 error_code = 1; + optional string error_msg = 2; + optional string debug_msg = 3; + optional string file = 4; + optional int32 lineno = 5; + optional int32 error_param = 6; +} + +//int32键值对 +message MFPair +{ + optional int32 key = 1; //key + optional int32 value = 2; //val +} + +//int64键值对 +message MFPair64 +{ + optional int64 key = 1; //key + optional int64 value = 2; //val +} + +//int32元组 +message MFTuple +{ + repeated int32 values = 1; //values +} + +//string元组 +message MFTupleString +{ + repeated string values = 1; //values +} + +//向量3d +message MFVec3 +{ + optional float x = 1 [default = 0]; //x轴 + optional float y = 2 [default = 0]; //y轴 + optional float z = 3 [default = 0]; //z轴 +} + +//属性变更 +/* + property_type: 1 血量 + property_type: 2 最大血量 + property_type: 3 背包 + property_subtype: 索引 + valule: 當前數量 + value2:數量上限 + property_type: 4 技能cd时间(剩余时间) + property_type: 5 技能cd时间(总时间) + property_type: 6 载具剩余子弹数 + property_type: 7 载具油量 + property_subtype: 0(当前油量)1(总油量)) 在同步当前油量前必然同步过总油量! + property_type: 8 当前武器的子弹剩余数量 + property_type: 9 当前道具(目前只有伪装) + property_subtype: 道具id + valule: 当前数量(数量<=0时除) + property_type: 10 更新武器子弹数和弹夹上限 + property_subtype: 武器索引 + valule: 当前数量 + valule2: 当前弹夹上限 + property_type: 11 载具 + property_subtype: car_uniid + valule: seat + property_type: 23 charid + valule: charid + property_type: 24 技能cd时间 + property_subtype: 技能id + valule: 技能cd时间(剩余时间) + property_type: 25 技能次数 + property_subtype: 技能id + valule: 当前可用次数 + property_type: 26 技能次数上限 + property_subtype: 技能id + valule: 次数上限 + property_type: 27 载具油量 + property_subtype: 当前油量 + valule: 最大油量 + property_type: 28 绝对值属性加成 + property_subtype: 属性id + valule: 属性绝对值 + property_type: 29 百分比属性加成 + property_subtype: 属性id + valule: 百分比绝对值 + property_type: 30 跟随目标id + valule: 目标id + property_type: 31 下潜后氧气 + property_subtype: 总量 + valule: 当前量 + property_type: 32 更新技能经验(需要容错,skill_id可能在本地找不到) + property_subtype: skill_id + valule: 经验 + property_type: 33 更新盾牌血量 + property_subtype: 血量上限 + valule: 当前血量 + property_type: 34 被谁抓了(猫的钩子技能) + property_subtype: + valule: 谁抓的你 + property_type: 35 更新主动技能副模式信息 + property_subtype: 副状态类型 + valule: 副状态cd时间(剩余时间) + value2: 副状态cd时间(总时间) + value3: 技能id + property_type: 36 复活币数量 + property_subtype: + valule: 数量 + property_type: 37 被暴击 + property_subtype: + valule: 暴击伤害 + property_type: 38 降落伞 + property_subtype: 降落伞id + valule: + property_type: 39 播放飞行特效 + property_subtype: 特效id,读取flyEffect表 + valule: 目标对象 + value2: 如果==自己的uniid则上传value3 + value3: 回传值 + property_type: 40 能量护盾 + property_subtype: 当前护盾值 + value: max护盾值 + property_type: 41 宝石 + value: 宝石数量 + property_type: 42 捡物品 + value: 物品对象uniid + property_type: 43 队伍成员数 + value: 成员数 + property_type: 44 队伍id + value: 队伍id + property_type: 45 兔子隐身提示时间 + property_subtype: 时间(单位毫秒) + value: max时间(单位毫秒) + property_type: 46 更新当前新手战引导步骤 + property_subtype: 第几步 <= 0时表示完成了所有步骤 + property_type: 47 技能宝石 + value: 宝石数量 + property_type: 48 护盾宝石 + value: 宝石数量 + property_type: 49 护甲 + property_subtype: 当前护甲值 + value: max护甲值 + property_type: 50 淘汰倒计时(只有在读取里才会发送) + value: 倒计时(秒) + property_type: 51 伤害数值 + property_subtype: 受击方uniid + value: 造成伤害 + value2: 0: 普通伤害 1:暴击 + value3: 攻击方uniid + property_type: 52 显示荣誉 +*/ +message MFPropertyChg +{ + optional int32 obj_id = 1; //对象id + optional int32 property_type = 2; //属性类型 + optional int32 property_subtype = 3; //属性子类型 + optional float value = 4; //属性值 + optional float value2 = 5; //属性值2 + optional float value3 = 6; //属性值3 +} + +//碰撞体 +message MFCollider +{ + optional int32 shape = 1; //形状 1:矩形 2:圆形(当是圆形的时候width=height) + optional int32 width = 2; //宽度 + optional int32 height = 3; //高度 +} + +//地图物件 +message MFMapObject +{ + optional int32 object_id = 1; //物件id(mapThing表id) + optional MFVec3 pos = 2; //位置 +} + +//武器 +message MFWeapon +{ + optional int32 weapon_id = 1; //武器id 当weapon_id == 0时表示无装备(装备位置显示空) + optional int32 weapon_lv = 2; //武器等级 + optional string weapon_uniid = 3; //武器唯一id + optional int32 ammo = 4; //弹药数 + optional int32 volume = 5; //弹夹容量 + optional int32 weapon_battle_lv = 6 [default = 0]; //武器战内等级(升级) +} + +//皮肤 +message MFSkin +{ + optional int32 skin_id = 1; //皮肤id + optional int32 skin_lv = 2; //皮肤等级 +} + +//玩家信息-部分 +message MFPlayerPart +{ + optional int32 obj_uniid = 1; //唯一id + optional MFVec3 pos = 2; //位置 + optional MFVec3 dir = 3; //朝向 + optional float speed = 4; //速度 +} + +//属性增量 +message MFAttrAddition +{ + optional int32 attr_id = 1; //属性id + optional float abs_val = 2; //绝对值加成 + optional float rate_val = 3; //百分比 +} + +//角色形象-本地如果没有full信息则忽略 +message MFCharacterImage +{ + optional int32 obj_uniid = 1; //唯一id + optional int32 cur_weapon_idx = 2; //当前武器索引 0-4 + optional MFWeapon weapon = 3; //武器 +} + +//组队标记目标位置 +message MFTeamMarkPos +{ + optional int32 obj_uniid = 1; //唯一id + optional MFVec3 pos = 2; //位置 +} + +//结算队伍信息 +message MFSettlementTeam2 +{ + optional int32 team_id = 1; //队伍Id + optional int32 team_rank = 2; //队伍排名 + repeated MFSettlementMember members = 3; //成员列表 +} + +//结算队伍成员信息 +message MFSettlementMember2 +{ + optional int32 obj_uniid = 1; //唯一id + optional string account_id = 2; //账号id + optional string name = 3; //昵称 + optional int32 hero_id = 4 [default = 0]; //英雄id +} + +//玩家信息-全量 +message MFPlayerFull +{ + optional int32 obj_uniid = 1; //唯一id + optional MFVec3 pos = 2; //位置 + optional MFVec3 dir = 3; //朝向 + optional int64 guild_id = 4; //公会id + + optional float max_health = 5; //血量 + optional float health = 6; //血量 + optional bool dead = 7; //是否已死亡 + optional bool downed = 8; //是否跌倒 + optional bool disconnected = 9; //是否断网 + repeated MFSkin skin = 13; //皮肤id + optional int32 backpack = 14; //背包 + optional int32 helmet = 16; //头盔 + optional int32 chest = 17; //防弹衣 + optional MFWeapon weapon = 18; //武器 + optional int32 energy_shield = 19; //能量护盾 + optional int32 vip = 20; //vip + optional int32 max_energy_shield = 22; //最大能量护盾 + repeated MFBodyState states = 23; //角色状态 + optional int32 kill_count = 24; //击杀数 + optional int32 emoji1 = 25; //表情1 + optional int32 emoji2 = 26; //表情2 + optional int32 parachute = 27; //降落伞 + repeated MFBuff buff_list = 28; //buff列表 + repeated MFEffect effect_list = 67; //特效列表 + optional int32 car_uniid = 29; //载具id + optional int32 car_seat = 34; //载具-座位0-3 + + optional bool can_revive = 30; //是否可复活 + optional int32 revive_countdown = 31; //复活倒计时 + optional string killer_name = 32; //杀手名称 + optional int32 killer_id = 33; //杀手id(自杀时为自己) 特殊id: -1:倒在安全区 + + optional int32 vip_lv = 35 [default = 0]; //vip等级 + optional int32 head_frame = 36 [default = 0]; //头像框 + optional int32 sex = 37 [default = 0]; //性别 + + repeated MFSkill skill_list = 38; //技能列表 + + repeated MFAttrAddition attr_addition= 61; //属性加成 + optional int32 follow_target = 62 [default = 0]; //跟随的目标id 0: 未跟随 + + optional int32 charid = 44; //人物id + optional float speed = 45; //速度 + optional int32 team_id = 71; //队伍id + + optional float shoot_offset_x = 50 [default = 0]; //射击偏移量-x + optional float shoot_offset_y = 51 [default = 0]; //射击偏移量-y + + optional string user_data = 60 [default = ""]; //用户自定义数据 + + optional int32 shield_hp = 65; //护盾血量 + optional int32 shield_max_hp = 66; //护盾血量上限 + + optional int32 gemstone = 68; //宝石 + optional int32 level = 69; //等级 + optional int32 hero_level = 72; //hero等级 + + optional int32 team_member_num = 70 [default = 0]; //队伍成员数 + + optional int32 armor_shield = 73; //护甲 + optional int32 max_armor_shield = 74; //最大护甲 + +} + +//阻挡物-部分 +message MFObstaclePart +{ + optional int32 obj_uniid = 1; //唯一id + optional MFVec3 pos = 2; //位置 + optional float scale = 3; //缩放比 +} + +//阻挡物-全量 +message MFObstacleFull +{ + optional int32 obj_uniid = 1; //唯一id + optional MFVec3 pos = 2; //位置 + optional MFVec3 size = 33; //大小(和pos rotate构成boxcollider) + optional float scale = 3; //缩放比 + optional float rotate = 5; //旋转,单位弧度,360度=2π弧度 + //出生帧号 born_frameno == SMUpdate.frmanoe时表示在当前这帧出生(可能出现为0的情况比如静态物件) + optional int32 born_frameno = 4 [default = 0]; + + optional int32 obstacle_id = 6; //阻挡物id + optional float health = 7; //血量 + optional bool dead = 8; //是否已死亡 + optional bool dead_at_thisframe = 9; //是否当前帧死亡(播放死亡特效) + optional int32 dead_reason = 42 [default = 0]; //死亡原因 0:被打 1:被开 + + optional bool is_door = 20; //是否门 + //只有当is_door==ture时以下字段才有意义 + //门状态定义: 0:关 1:开 当door_old_state != door_new_state时播动画(开/关门) + optional int32 door_id = 22; //门id + optional int32 door_old_state = 23; //门前一个状态 + optional int32 door_new_state = 24; //门当前状态 + optional int32 door_house_uniid = 25; //门所属房间唯一id + optional int32 door_house_id = 26; //门所属房间id + optional float door_width = 27; //门宽度 + optional float door_height = 28; //门高度 + optional int32 door_open_times = 29; //门开启次数,每次开/关 ++times 0:客户端自动开 + optional string button_name = 30; //按钮名(不为空是显示按钮,靠近时显示) + optional MFCollider collider = 31; //碰撞体(有值的时候读取没值的时候还是读取配置表里的碰撞) + + optional int32 team_id = 41; //队伍id +} + +//建筑物-部分 +message MFBuildingPart +{ + optional int32 obj_uniid = 1; //唯一id + optional MFVec3 pos = 2; //位置 +} + +//建筑物-全量 +message MFBuildingFull +{ + optional int32 obj_uniid = 1; //唯一id + optional MFVec3 pos = 2; //位置 + optional int32 building_id = 3; //建筑物id + + optional bool ceiling_dead = 6; +} + +//loot-部分 +message MFLootPart +{ + optional int32 obj_uniid = 1; //唯一id + optional MFVec3 pos = 2; //位置 +} + +//loot-全量 +message MFLootFull +{ + optional int32 obj_uniid = 1; //唯一id + optional MFVec3 pos = 2; //位置 + optional MFVec3 size = 10; //大小(和pos rotate构成boxcollider) + optional float rotate = 11 [default = 0]; //旋转 单位弧度,360度=2π弧度 + optional MFVec3 born_pos = 3; //出生位置 + optional bool show_anim = 4; //是否显示动画 + + optional int32 item_id = 6; //道具id + optional int32 count = 7; //数量 + optional int32 age_ms = 8; + optional int32 item_level = 9 [default = 1]; //道具等级 +} + +//英雄(分身)-部分 +message MFHeroPart +{ + optional int32 obj_uniid = 1; //唯一id + optional MFVec3 pos = 2; //位置 + optional MFVec3 dir = 3; //朝向 + +} + +//英雄(分身)-全量 +message MFHeroFull +{ + optional int32 obj_uniid = 1; //唯一id + optional MFVec3 pos = 2; //位置 + optional MFVec3 dir = 3; //朝向 + optional int32 heroid = 4; //配置表id + optional int32 master_uniid = 5; //主人id + optional float health = 10; //血量 + optional bool dead = 11; //是否已死亡 + repeated MFBuff buff_list = 12; //buff列表 + optional float max_health = 13; //最大血量 + repeated MFEffect effect_list = 14; //特效列表 + optional int32 team_id = 15; //队伍id + optional int32 hero_level = 16; //hero等级 + + repeated MFSkill skill_list = 18; //技能列表 +} + +//载具-部分 +message MFCarPart +{ + optional int32 obj_uniid = 1; //唯一id + optional MFVec3 pos = 2; //位置 + optional MFVec3 dir = 3; //朝向 +} + +//载具-全量 +message MFCarFull +{ + optional int32 obj_uniid = 1; //唯一id + optional MFVec3 pos = 2; //位置 + optional MFVec3 dir = 3; //朝向 + optional int32 car_id = 4; //载具id + optional int32 driver = 5; //驾驶员id + optional int32 heroid = 7; //配置表id + optional float health = 10; //血量 + optional bool dead = 11; //是否已死亡 + repeated MFBuff buff_list = 12; //buff列表 + optional float max_health = 13; //最大血量 + optional int32 oil = 14; //当前油量 + optional int32 max_oil = 15; //最大油量 + optional int32 bullet_num = 16; //子弹数量 + repeated MFEffect effect_list = 18; //特效列表 + optional int32 team_id = 19; //队伍id + repeated MFSkill skill_list = 20; //技能列表 + repeated int32 special_operators = 21; //指定能上载具的玩家uniid,空的话则不限 + /* + 乘客列表(包含驾驶员) + !!!注意这里只返回客户端必要的用于显示玩家外观的信息而不是全量信息 + */ + repeated MFPlayerFull passengers = 6; + optional int32 seat_num = 17; //座位数 + optional int32 born_frameno = 8; //出生帧号 born_frameno == SMUpdate.frmanoe时表示在当前这帧出生 +} + +//对象信息-部分 +message MFObjectPart +{ + //1:player 2:obstacle 3:building 5:loot 10:hero 11:car + optional int32 object_type = 1; + + optional MFPlayerPart union_obj_1 = 2; + optional MFObstaclePart union_obj_2 = 3; + optional MFBuildingPart union_obj_3 = 4; + optional MFLootPart union_obj_5 = 6; + optional MFHeroPart union_obj_10 = 11; + optional MFCarPart union_obj_11 = 12; +} + +//对象信息-全量 +message MFObjectFull +{ + //1:player 2:obstacle 3:building 5:loot 10:hero 11:car + optional int32 object_type = 1; + + optional MFPlayerFull union_obj_1 = 2; + optional MFObstacleFull union_obj_2 = 3; + optional MFBuildingFull union_obj_3 = 4; + optional MFLootFull union_obj_5 = 6; + optional MFHeroFull union_obj_10 = 11; + optional MFCarFull union_obj_11 = 12; + + optional int32 obj_uniid = 14; //唯一id + optional int32 object_flags = 15; //对象标志位 1<<0: 存缓存 1<<1:读缓存 +} + +//活跃玩家数据(当前) +message MFActivePlayerData +{ + optional int32 action_type = 3; //0: none 1:reload 2:useitem 3:relive 4: rescue + optional int32 action_duration = 5; //持续时间毫秒 + optional int32 action_item_id = 6; + optional int32 action_target_id = 7; + optional int32 action_param = 36; //公共参数当是治疗时表示治疗量 + /* + action触发的帧号,当服务器下发的action_type和客户端本地的action_type相同时 + action_frameno不同也要播放对应的动画,视为同一种action_type的不同触发 + */ + optional int32 action_frameno = 1; + + repeated MFPair items = 8; //存放玩家身上携带的装备信息(目前只存伪装) key:道具id value:数量 + + repeated MFSkin skin = 30; //皮肤id + optional int32 backpack = 31; //背包 + optional int32 helmet = 32; //头盔 + optional int32 chest = 33; //防弹衣 + + optional float max_health = 34; //血量 + optional float health = 35; //血量 + + optional int32 cur_scope = 10; //当前视野倍数 1 2 4 8 15 + /* + 0: 9mm + 1: 556mm + 2: 762mm + 3: 12gauge + 4: rpg火药(榴弹炮) + 5: frag 手雷 + 6: smoke 烟雾弹 + 7: healthkit 医疗包 + 8: 止痛药 + 9: + 10: + 11: + + 12: 1xscope + 13: 2xscope + 14: 4xscope + 15: 8xscope + 16: 15xscope + */ + repeated int32 inventory = 11; //库存 + + optional int32 cur_weapon_idx = 15; //当前武器索引 0-4 + /* + 武器列表1-4 + 0:拳头 + 1:枪1 + 2:枪2 + 3:手雷 + 4:烟雾弹 + 5: 地雷 + 6: 燃烧瓶 + 7: 陷阱 + 8: 毒气弹 + 9: c4 + 10: 盾墙 + 11: 信号抢 + 12: 汽油桶 + */ + repeated MFWeapon weapons = 16; + + optional int32 energy_shield = 40; //能量护盾 + optional int32 max_energy_shield = 41; //最大能量护盾 + + optional int32 shield_hp = 65; //护盾血量 + optional int32 shield_max_hp = 66; //护盾血量上限 + + optional int32 spectator_count = 20; + repeated MFBodyState states = 27; //角色状态 + + repeated MFSkill skill_list = 28; //技能列表 + + repeated MFAttrAddition attr_addition= 61; //属性加成 + optional string name = 62; //昵称,不为undefine的时候覆盖本地 + + optional float shoot_offset_x = 50 [default = 0]; //射击偏移量-x + optional float shoot_offset_y = 51 [default = 0]; //射击偏移量-y + + optional int32 dive_oxygen_max = 63; //下潜时氧气总量 + optional int32 dive_oxygen_curr = 64; //下潜时氧气当前量 + + optional int32 gemstone = 68; //宝石 + + optional int32 armor_shield = 73; //护甲 + optional int32 max_armor_shield = 74; //最大护甲 +} + +//毒圈数据 +message MFGasData +{ + /* + 0: 进入战前准备 + 3:跳伞状态 + 1: 辐射区将在多少时间后扩大 + 2: 辐射区正在扩大 + */ + optional int32 mode = 1; //0:inactive 1:waiting 2:moving 3:jump + optional float duration = 2; //持续时间(秒) + optional float total_duration = 7; //总时间(秒),只在inactive时有效 + optional MFVec3 pos_old = 3; //前一个圆心 + optional MFVec3 pos_new = 4; //新圆心 + optional float rad_old = 5; //前一个圆半径 + optional float rad_new = 6; //新圆半径 +} + +//队伍数据 +message MFTeamData +{ + optional int32 team_id = 61; //队伍Id + optional int32 player_id = 1; //玩家id + optional MFVec3 pos = 2; //位置 + optional MFVec3 dir = 3; //方向 + optional float health = 4; //血量 + optional bool disconnected = 5 [default = false]; //是否短线 + optional bool dead = 6 [default = false]; //是否死亡 + optional bool downed = 7 [default = false]; //是否倒下 + optional string name = 8; //名字(只同步一次) + optional float max_health = 9; //最大血量 + optional bool riding = 40 [default = false]; //是否倒 下 + optional string user_data = 60 [default = ""]; //用户自定义数据(只同步一次) + optional int32 score = 63 [default = 0]; //pve模式积分 + optional int32 hero_id = 64 [default = 0]; //英雄id(只同步一次) + optional int32 level = 65 [default = 0]; //等级 + optional int32 hero_level = 72; //hero等级 + + //一下字段只在结算的时候该字段才有内容 + optional string account_id = 10; //账号id + optional string avatar_url = 11; //头像 + optional int64 user_value1 = 31; //对应好友系统的user_value1 + optional int64 user_value2 = 32; //对应好友系统的user_value2 + optional int64 user_value3 = 33; //对应好友系统的user_value3 + optional int64 guild_id = 34; //公会id + optional int32 vip_lv = 35 [default = 0]; //等级 + optional int32 head_frame = 36 [default = 0]; //头像框 + optional int32 sex = 37 [default = 0]; //性别 + repeated MFSkin skin = 39; //皮肤id +} + +//队伍数据 +message MFTeamDataNew +{ + optional int32 team_id = 61; //队伍Id + optional int32 player_id = 1; //玩家id + optional MFVec3 pos = 2; //位置 + optional MFVec3 dir = 3; //方向 + optional float health = 4; //血量 + optional bool disconnected = 5 [default = false]; //是否短线 + optional bool dead = 6 [default = false]; //是否死亡 + optional bool downed = 7 [default = false]; //是否倒下 + optional string name = 8; //名字(只同步一次) + optional float max_health = 9; //最大血量 + optional bool riding = 40 [default = false]; //是否倒 下 + optional string user_data = 60 [default = ""]; //用户自定义数据(只同步一次) + optional int32 score = 63 [default = 0]; //pve模式积分 + optional int32 hero_id = 64 [default = 0]; //英雄id(只同步一次) + optional int32 level = 65 [default = 0]; //等级 + optional int32 hero_level = 72; //hero等级 + + //一下字段只在结算的时候该字段才有内容 + optional string account_id = 10; //账号id + optional string avatar_url = 11; //头像 + optional int64 user_value1 = 31; //对应好友系统的user_value1 + optional int64 user_value2 = 32; //对应好友系统的user_value2 + optional int64 user_value3 = 33; //对应好友系统的user_value3 + optional int64 guild_id = 34; //公会id + optional int32 vip_lv = 35 [default = 0]; //等级 + optional int32 head_frame = 36 [default = 0]; //头像框 + optional int32 sex = 37 [default = 0]; //性别 + repeated MFSkin skin = 39; //皮肤id +} + +//子弹 +message MFBullet +{ + optional int32 player_id = 1; //玩家id + optional int32 bullet_id = 2; //子弹id + optional MFVec3 pos = 3; //位置 + optional MFVec3 dir = 4; //方向 + optional int32 gun_lv = 5; //枪等级 + optional int32 bulletskin = 6; //子弹皮肤 未用到 + optional int32 gun_id = 10; //枪id + optional float fly_distance = 11; //只有手雷和烟雾弹时这个字段才有意义 + optional int32 bullet_uniid = 12; //子弹唯一id + optional int32 hand = 16 [default = 0]; //手 0:右手 1:左手 + + //追踪型子弹以下字段才有意义(trace_target_uniid != 0) + optional int32 trace_target_uniid = 13 [default = 0]; //不为空和0的时候表示要追踪的目标对象uniid + optional float track_change_time = 14 [default = 0]; //变轨时间间隔(毫秒) + optional int32 is_through = 15 [default = 0]; //是否穿墙 + + //客户端上报型子弹一下字段才有意义(reporter_list.size() > 0) + repeated int32 reporter_list = 20; //上报者列表 +} + +//射击 +message MFShot +{ + optional int32 player_id = 1; //玩家id + optional MFWeapon weapon = 2; //武器id + optional int32 hole = 5 [default = 0]; //炮孔(从0开始) + optional int32 aiming = 6 [default = 0]; //是否瞄准中 +} + +//投掷 +message MFThrow +{ + optional int32 weapon_id = 1; //枪id + optional int32 throw_uniid = 2; //唯一id > 0 (客户端维持唯一) + optional MFVec3 pos = 3; //位置 + optional MFVec3 dir = 4; //方向 + optional float fly_distance = 5; //飞行距离 + optional int32 estimated_time = 6; //预估时间(单位毫秒) +} + +//爆炸 +message MFExplosion +{ + optional int32 item_id = 1; //配置表id + optional MFVec3 pos = 2; //位置 + optional int32 player_id = 3; //玩家id + optional int32 effect = 4 [default = 0]; //爆照效果 0:普通爆照 1:核爆炸 + optional float rotate = 5; //旋转 + optional float rad = 6; //半径 + optional int32 bullet_uniid = 7; //子弹唯一id,如果是子弹产生的爆炸 +} + +//烟雾 +message MFSmoke +{ + optional int32 item_id = 1; //配置表id + optional MFVec3 pos = 2; //位置 + optional int32 player_id = 4; //玩家id + optional float time_addition = 5; //烟雾弹时间加成(单位毫秒) +} + +//表情 +message MFEmote +{ + optional int32 emote_id = 1; //表情id + optional int32 player_id = 3; //玩家id + optional string msg = 5; +} + +//英雄结算信息 +message MFHeroStats +{ + optional string hero_uniid = 1 [default = ""]; //英雄唯一id + optional string hero_name = 2 [default = ""]; //英雄名称 + optional int32 hero_id = 3 [default = 0]; //英雄唯id + optional int32 reward_ceg = 4 [default = 0]; //英雄获得的ceg数量 + optional int32 ceg_uplimit = 5 [default = 0]; //英雄获得的ceg数量上限 + optional int32 today_get_ceg = 6 [default = 0]; //英雄今天获得的ceg数量 +} + +//武器结算信息 +message MFWeaponStats +{ + optional string weapon_uniid = 1 [default = ""]; //武器唯一id + optional string weapon_name = 2 [default = ""]; //武器名称 + optional int32 weapon_id = 3 [default = 0]; //武器唯id + optional int32 reward_ceg = 4 [default = 0]; //武器获得的ceg数量 + optional int32 ceg_uplimit = 5 [default = 0]; //武器获得的ceg数量上限 + optional int32 today_get_ceg = 6 [default = 0]; //武器今天获得的ceg数量 +} + +//游戏结束时玩家统计信息 +message MFPlayerStats +{ + optional int32 player_id = 1; //玩家id + optional string player_avatar_url = 2; //玩家头像 + + //本次成绩 + optional int32 time_alive = 3; //存活时间(毫秒) + optional int32 kills = 4; //击杀敌人数 + optional int32 damage_amount = 8; //伤害总量 + optional int32 heal_amount = 20; //治疗总量 + optional int32 assist = 50; //助攻 + optional int32 rescue = 51; //救援 + optional int32 pve_wave = 52; //pve波次 + optional int32 revive = 53; //复活次数 + optional int32 rank_chg = 54; //排行变更 + //历史最佳成绩 + optional int32 history_time_alive = 30; //存活时间(毫秒) + optional int32 history_kills = 31; //击杀敌人数 + optional int32 history_damage_amount = 32; //伤害总量 + optional int32 history_heal_amount = 33; //治疗总量 + + optional int32 gold = 10; //金币 + optional int32 score = 11; //积分 + repeated MFPair items = 6; //奖励道具 key:item_id value:数量 + optional int32 pass_score = 9; //通行证积分 + optional int32 rank_score = 13; //排名积分 + optional bool has_pass = 27; //是否有通行证 + + repeated MFPair extra_drop = 12; //额外掉落,key:item_id value:数量(看广告) + + optional bool dead = 5; //是否已死亡 + optional int32 killer_id = 7; //杀手id(自杀时为自己) 特殊id: -1:倒在安全区 + optional string killer_name = 40; //杀手名称 + optional string killer_avatar_url = 41; //杀手头像(机器人头像为空) + optional string killer_account_id = 42; //杀手accountid(机器人为空) + + optional string account_id = 21; //账号id + optional int64 guild_id = 22; //公会id + optional int32 rescue_guild_member = 23; //救起公会成员次数 + + optional int32 vip_lv = 35 [default = 0]; //等级 + optional int32 head_frame = 36 [default = 0]; //头像框 + optional int32 sex = 37 [default = 0]; //性别 + optional int32 charid = 38; //人物id + optional int32 team_id = 39; //tamid + optional string nickname = 43; //昵称 + + repeated MFSkin skin = 45; //皮肤id + + optional MFHeroStats hero_stats = 46; //英雄结算信息 + repeated MFWeaponStats weapons_stats = 47; //武器结算信息 +} + +//空投 +message MFAirDrop +{ + optional int32 appear_time = 1; //箱子出现时间(毫秒) + optional int32 box_id = 2; //箱子id + optional MFVec3 pos = 3; //位置 +} + +//空袭 +message MFAirRaid +{ + optional int32 appear_time = 1; //空袭出现时间(毫秒) + optional MFVec3 pos = 3; //空袭位置 + optional float rad = 4; //空袭半径 + optional int32 continue_time = 5; //轰炸持续时间,(在空袭出现后!!!) +} + +//buff +message MFBuff +{ + optional int32 buff_id = 1; //buff id + optional float left_time = 2; //剩余时间(单位毫秒) + optional float lasting_time = 3; //持续时间(总时间毫秒) + repeated float params = 4; //当是驾驶员或者乘客状时 params[0]:car_id + optional int32 buff_uniid = 5; //buff唯一id + optional float res_scale = 6 [default = 1]; //客户端资源缩放 +} + +//effect +message MFEffect +{ + optional int32 effect_uniid = 1; //特效唯一id + optional int32 effect_id = 5; //特效id +} + +//buff变更 +message MFBuffChg +{ + optional int32 obj_id = 1; //对象id + optional int32 chg = 2; //0:新增/更新 1:删除 + optional MFBuff buff = 3; //buff +} + +//特效变更 +message MFEffectChg +{ + optional int32 obj_id = 1; //对象id + optional int32 chg = 2; //0:新增/更新 1:删除 + optional MFEffect effect = 3; //effect +} + +//对象状态(只同步一次客户端自己到及时,有变化时服务器会再次下发) +message MFBodyState +{ + /* + 1: 止痛药持续加血 + 2: 在飞机上(这时left_time、lasting_time无意义) + 3: 跳伞中 + + 4: 隐身中(队友可见) + 5: 加速中 + 6: 伤害加深 + 7: 护盾 + 8: 回血 + 9: 反伤 + 10: 分身 + 11:攻击加成 + */ + optional int32 state_type = 1; + optional float left_time = 2; //剩余时间(单位毫秒) + optional float lasting_time = 3; //持续时间(总时间毫秒) +} + +//飞机 +message MFPlane +{ + optional MFVec3 start_point = 1; //飞机起点 + optional MFVec3 end_point = 2; //飞机终点 + optional MFVec3 pos = 3; //飞机当前位置 + optional float plane_speed = 4; //飞机速度(像素/秒) +} + +//载具信息(用于小地图显示) +message MFMapCarInfo +{ + optional int32 car_id = 1; //载具id(读equip表) + optional MFVec3 pos = 2; //载具坐标 + optional MFVec3 size = 3; //载具坐标 大小(和pos rotate构成boxcollider) + optional float rotate = 4 [default = 0]; //旋转 单位弧度,360度=2π弧度 +} + +//队友信息 +message MFTeamMember +{ + optional string account_id = 1; //账号id + optional int32 rank = 2; //段位 + optional bool is_leader = 3; //是否队长 + optional int32 game_times = 4; //游戏次数 + optional int32 win_times = 5; //吃鸡次数 + optional int32 kill_times = 6; //击杀数 + optional int32 create_time = 7; //账号创建时间 +} + +//位置信息 +message MFPosition +{ + optional int32 obj_uniid = 1; //唯一id + optional MFVec3 pos = 2; //位置 + optional MFVec3 dir = 3; //朝向 + optional int32 race = 4; //1:人 2:僵尸 +} + +message MFSkill +{ + optional int32 skill_id = 1; //技能id + optional int32 actived = 6; //技能是否激活 + optional int32 left_time = 2; //技能cd时间(剩余时间) + optional int32 cd_time = 3; //技能cd时间(总时间) + optional int32 curr_times = 4; //当前可用次数 + optional int32 max_times = 5; //次数上限 + optional int32 exp = 7; //当前经验 + optional int32 max_exp = 8; //经验上限(当满级以后exp=0 max_exp=0) + optional int32 level = 20 [default = 1]; //当前等级 + /* + 副状态:当有副状态的时候客户端优先显示副状态 + */ + optional int32 minor_type = 9 [default = 0]; // 1: 闪烁 + optional int32 minor_left_time = 10 [default = 0]; // 副状态cd时间(剩余时间) + optional int32 minor_cd_time = 11 [default = 0]; // 副状态cd时间(总时间) +} + +message MFPlaySkill +{ + optional int32 obj_uniid = 1; //技能id + optional int32 skill_id = 2; //技能id +} + +message MFTextElement +{ + optional string text = 1; //文本内容 + optional int32 color = 2 [default = 0xFFFFFF]; //默认系统颜色rgb +} + +message MFImageElement +{ + optional int32 id = 1; //装备id +} + +message MFHeroHeadElement +{ + optional int32 id = 1; //英雄id +} + +message MFRichTextElement +{ + //1:TextElement 2:ImageElement 3:HeroHeadElement + optional int32 element_type = 1; //富文本类型 + optional MFTextElement union_obj_1 = 2; //文本元素 + optional MFImageElement union_obj_2 = 3; //图片元素 + optional MFHeroHeadElement union_obj_3 = 4; //英雄头像元素 +} + +message MFMatchTeamMember +{ + optional string account_id = 1; //账号id account_id + optional string name = 2; //角色名 + optional string avatar_url = 3; //头像 + optional int32 hero_id = 4; //英雄id + repeated MFWeapon weapons = 5; //武器列表 + optional bool is_leader = 8; //是否队长 + optional int32 state = 9; //0:准备 1:已准备 + optional int32 head_frame = 10; //头像框 +} + +//该消息每秒同步 +message MFMatchInfo +{ + repeated MFMatchTeamMember members = 1; //成员列表 + optional int32 phase = 2; //阶段 1:合并队伍(匹配中) 2:选择角色 3:锁定(已准备) + optional int32 countdown = 3; //倒计时(单位秒) + optional int32 predict_time = 4; //预计时间(单位秒) +} + +//结算奖励项 +message MFOverRewardItem +{ + optional string obtain_gold = 1 [default = "0"]; //实际获得金币数 + optional string gold_limit = 2 [default = "0"]; //今天可获得的金币上限 + optional int32 id = 3; //英雄或者武器id + optional string curr_gold = 4 [default = "0"]; //当前金币数 +} + +//结算奖励 +message MFOverReward +{ + optional MFOverRewardItem hero = 1; //英雄 + optional MFOverRewardItem weapon1 = 2; //武器1 + optional MFOverRewardItem weapon2 = 3; //武器2 + optional string bounds = 4 [default = "0"]; + optional string total = 5 [default = "0"]; //总数 +} + +//结算英雄奖励 +message MFOverRewardHero +{ + optional string hero_uniid = 1 [default = "0"]; //英雄唯一id + optional int32 id = 2 [default = 0]; //id + optional string gold_limit = 3 [default = "0"]; //ceg数量上限 + optional string obtain_gold = 4 [default = "0"]; //实际获得ceg数量 + optional string curr_gold = 5 [default = "0"]; //当前ceg数量 +} + +//结算奖励项 +message MFOverRewardItemNew +{ + optional int32 item_id = 1; //道具id + optional int32 item_num = 2; //道具数量 +} + +//结算奖励 +message MFOverRewardNew +{ + optional MFOverRewardHero hero = 1; //英雄 + repeated MFOverRewardItemNew items = 2; //碎片奖励 +} + +message MFRewardItem +{ + optional int32 item_id = 1; //道具id + optional string item_num = 2; //道具数量 +} + +//游戏结束时玩家统计信息 +message MFPlayerStats2 +{ + optional int32 id = 1; //玩家id + optional string account_id = 2; //账号id(客户端不用使用) + optional string name = 4; //玩家名字 + optional int32 head = 3; //头像id + optional int32 head_frame = 5 [default = 0]; //头像框 + optional int32 sex = 6 [default = 0]; //性别 + optional int32 hero_id = 7; //英雄id + optional int32 dead = 8; //是否已死亡 + optional int32 is_myself = 9; //是否自己 + optional int32 is_mvp = 10; //是否mvp + + //本次成绩 + optional int32 pvp_kill = 11; //pvp击杀敌人数 + optional int32 pvp_damage = 12; //pvp伤害总量 + optional int32 pvp_assist = 14; //pvp助攻 + optional int32 pvp_survia_time = 16; //pvp存活时间(毫秒) + optional int32 pvp_recover = 13; //pvp治疗总量 + optional int32 pvp_rescue = 15; //pvp救援 + + optional int32 pve_order = 20; //pve波次 + optional int32 pve_score = 21; //pve分数 + optional int32 pve_star = 22; //pve星 + optional int32 pve_damage = 23; //pve伤害总量 + optional int32 pve_revive = 25; //pve复活次数 + optional int32 pve_survia_time = 26; //pvp存活时间(毫秒) + optional int32 pve_wave = 30; //pve波次 + optional int32 pve_max_wave = 31; //pve总波次 +} + +//结算信息 +message MFSettlement +{ + optional int32 version = 1; //版本 + optional string room_uuid = 2; //房间唯一id + optional int32 room_mode = 3; //0:吃鸡模式 1:歼灭模式 2:生存模式 + optional int32 match_mode = 4; //比赛模式 0: pvp 1:排位赛(只有吃鸡模式下该字段才有意义) + optional int32 team_mode = 5; //0:个人 1:组队 + optional int32 game_over = 6; //是否结束 + optional int32 victory = 7; //是否胜利 + optional int32 watchable = 8; //是否可观战 + optional int32 team_id = 9; //队伍id + optional string account_id = 50; //自己的账号id + optional int32 temmate_all_dead = 51; //队友是否全部阵亡 + + optional int32 map_id = 10; //地图id + optional string map_name = 12; //地图名称 + optional int32 rank_score_chg = 14; //排位赛积分变更 + repeated MFRewardItem spoils_items = 15; //战利品 0: 道具id 1:道具数量 + + //已下字段只在排位赛有效 + optional int32 old_rank = 16; //老段位 + optional int32 new_rank = 17; //新段位 + optional int32 old_score = 18; //老段位积分 + optional int32 new_score = 19; //新段位积分 + + optional int32 pvp_settlement_type = 52; //結算類型0:個人 1:組隊 + optional int32 pvp_settlement_color = 53; // 0:灰 1:黃 + optional int32 pvp_team_rank = 20; //队伍排名 + optional int32 pvp_personal_rank = 21; //个人排名 + optional int32 pvp_my_rank = 22; //我的排名 + optional int32 pvp_max_rank = 23; //最大排名 + optional int32 pvp_total_human_num = 24; //房间总人数 + optional int32 pvp_alive_human_num = 25; //房间剩余存活人数 + optional int32 pvp_total_team_num = 26; //本次战斗队伍总数 + + optional int32 pve_settlement_color = 60; // 0:灰 1:黃 + optional int32 pve_wave = 30; //pve波次 + optional int32 pve_max_wave = 31; //pve总波次 + optional int32 pve_instance_id = 32; //pve副本id + optional int32 pve_boss_killed = 33; //pve副本boos是否被击杀 + + optional MFOverReward reward = 40; //结算奖励 + repeated MFPlayerStats2 members_stats = 42; //队伍成员信息统计 +} + +//成员结算信息 +message MFSettlementMember +{ + optional int32 obj_uniid = 1; //玩家id + optional string account_id = 2; //账号id(真人才有account_id) + optional string name = 4; //玩家名字 + optional int32 head = 3; //头像id + optional int32 head_frame = 5 [default = 0]; //头像框 + optional int32 sex = 6 [default = 0]; //性别 + optional int32 hero_id = 7; //英雄id + optional int32 dead = 8; //是否已死亡 + optional int32 is_mvp = 10; //是否mvp + + //已下字段只在排位赛有效 + optional int32 old_rank = 16; //老段位 + optional int32 new_rank = 17; //新段位 + optional int32 old_score = 18; //老段位积分 + optional int32 new_score = 19; //新段位积分 + + //本次成绩 + optional int32 pvp_kill = 101; //pvp击杀敌人数 + optional int32 pvp_damage = 102; //pvp伤害总量 + optional int32 pvp_assist = 103; //pvp助攻 + optional int32 pvp_survia_time = 104; //pvp存活时间(毫秒) + optional int32 pvp_recover = 105; //pvp治疗总量 + optional int32 pvp_rescue = 106; //pvp救援 + optional int32 pvp_personal_rank = 109; //个人排名 + + optional int32 pve_order = 201; //pve波次 + optional int32 pve_score = 202; //pve分数 + optional int32 pve_star = 203; //pve星 + optional int32 pve_damage = 204; //pve伤害总量 + optional int32 pve_revive = 205; //pve复活次数 + optional int32 pve_survia_time = 206; //pvp存活时间(毫秒) + optional int32 pve_wave = 207; //pve波次 + optional int32 pve_max_wave = 208; //pve总波次 + optional int32 pve_boss_killed = 209; //pve副本boos是否被击杀 + + optional MFOverReward _reward = 301; //结算奖励 + repeated MFRewardItem _spoils_items = 302; //战利品 0: 道具id 1:道具数量 + optional MFOverRewardNew reward = 303; //结算奖励 +} + +//结算信息 +/* + pvp_my_rank + pvp_max_rank + 这两个字段在新版里处理方式 + + 当是组队结算时 + pvp_my_rank: pvp_team_rank + pvp_max_rank: pvp_total_team_num + 当是个人结算时 + pvp_my_rank: member.pvp_personal_rank + pvp_max_rank: pvp_total_human_num + + 1、先判断settlement_status == 0 则表示用战斗数据(个人结算pvp_settlement_type=0) ,1则调用小胡的接口 + +settlement_status == 0 的时候: member.reward、member.spoils_items、 pvp_team_rank为空 + */ +message MFSettlementNew +{ + optional int32 version = 1; //版本 + optional int32 team_id = 2; //队伍id + optional string room_uuid = 3; //房间唯一id + optional int32 room_mode = 4; //0:pvp 1: pve + optional int32 team_mode = 6; //0:个人 1:组队(保留) + optional int32 game_over = 7; //游戏是否结束 + optional int32 victory = 8; //是否胜利(pvp:吃鸡 pve:是否通关) + optional int32 watchable = 9; //是否可观战,小胡那的接口写死0(看历史不可观战) + optional int32 map_id = 10; //地图id + optional string battle_uuid = 11; //本次战斗唯一id + optional int32 settlement_status = 12; //0: 结算中(读取个人结算数据) 1:已结算(请求小胡接口) + + optional int32 pvp_settlement_type = 101; //結算類型0:個人 1:組隊(保留) + optional int32 pvp_settlement_color = 102; // 0:灰 1:黃 + optional int32 pvp_team_rank = 103; //队伍排名 + optional int32 pvp_total_human_num = 105; //房间总人数 + optional int32 pvp_alive_human_num = 106; //房间剩余存活人数 + optional int32 pvp_total_team_num = 107; //本次战斗队伍总数 + optional int32 pvp_match_mode = 108; //比赛模式 0: pvp 1:排位赛 + + optional int32 pve_settlement_color = 201; // 0:灰 1:黃 + optional int32 pve_wave = 202; //pve波次 + optional int32 pve_max_wave = 203; //pve总波次 + optional int32 pve_instance_id = 304; //pve副本id + + repeated MFSettlementMember members = 401; //队伍成员信息统计 +} + +//沙盘消息-全量信息 +message MFSandTableFullMsg +{ + optional int32 obj_uniid = 1; //唯一id + optional MFVec3 pos = 2; //位置 + optional MFVec3 dir = 3; //朝向 + optional int32 hero_id = 4; //人物id + optional int32 team_id = 5; //队伍Id + optional MFVec3 target_pos = 6; //目标位置 +} + +//沙盘消息-部分信息 +message MFSandTablePartMsg +{ + optional int32 obj_uniid = 1; //唯一id + optional MFVec3 pos = 2; //位置 + optional MFVec3 dir = 3; //朝向 + optional int32 team_id = 4; //队伍Id + optional MFVec3 target_pos = 6; //目标位置 +} + +//沙盘消息-删除对象信息 +message MFSandTableRemoveObject +{ + optional int32 obj_uniid = 1; //唯一id +} + +//沙盘消息 +message MFSandTableMsg +{ + /* + 1: 全量信息 + 2:部分信息 + 3:删除对象 + */ + optional int32 msg_id = 1; //消息id + + optional MFSandTableFullMsg union_obj_1 = 2; + optional MFSandTablePartMsg union_obj_2 = 3; + optional MFSandTableRemoveObject union_obj_3 = 4; +} + +//沙盘信息 +message MFSandTable +{ + repeated MFSandTableMsg msgs = 1; //沙盘消息列表 + optional int32 max_human_num = 2; //最大人数 +} + +//对象位置坐标 +message MFObjPosition +{ + optional int32 obj_uniid = 1; //对象唯一id + optional MFVec3 pos = 2; //坐标 + optional MFVec3 dir = 3; //朝向 +} + +//对象击杀 +message MFKill +{ + optional int32 obj_uniid = 1; //对象唯一id +} + + +//end mfmsg + +//加入 +message CMJoin +{ + optional int32 server_id = 1; //serverid + optional string team_uuid = 2; //队伍唯一id (没组队时为空字符串) + optional string account_id = 3; //账号id account_id + optional int32 team_mode = 4; //队伍模式 0:单人 1:多人 + optional int32 proto_version = 5; //协议版本号Constant_e.ProtoVersion + optional bool auto_fill = 6; //是否自动填充玩家 + optional string name = 8; //角色名 + optional string avatar_url = 11; //头像 + repeated MFWeapon weapons = 17; //武器列表 + optional string session_id = 20; //session_id + optional int32 head_frame = 36 [default = 0]; //头像框 + optional int32 sex = 37 [default = 0]; //性别 + repeated MFTeamMember team_members = 51; //包括自己 + optional int32 room_mode = 52; //0:吃鸡模式 1:pve 2:排位赛 3:moba + optional int32 mapid = 53; //地图id 0:随机地图 + optional string user_data = 60 [default = ""]; //用户自定义数据 + optional int32 hero_id = 61; //英雄id + optional string hero_uniid = 71; //英雄唯一id + optional int32 pve_instance_id = 72; //pve副本id + optional int32 team_slot_num = 73; //队伍槽位数1-4 + optional int32 force_enter_newbie_room = 74; //强制进新手房 + optional string custom_room_payload = 75; //自定义房间透传数据 +} + +//断线重连 +message CMReconnect +{ + optional int32 server_id = 1; //保留 + optional string team_uuid = 2; //保留 + optional string account_id = 3; //账号id + optional string session_id = 4; //session_id + optional string room_uuid = 5; //房间唯一id + optional string server_info = 6; //服务器信息 +} + +//断线重连回复 +message SMReconnect +{ + optional int32 errcode = 1; //错误码 0:成功 1:重连失败 + optional string errmsg = 2; //错误描述 +} + +//移动 +message CMMove +{ + optional int32 seq = 1; //序号 + + optional MFVec3 move_dir = 2; //移动-方向 + optional MFVec3 attack_dir = 3; //攻击方向(朝向) + + optional bool shot_start = 4; //射击-单发 + optional bool shot_hold = 5; //射击-连发 + optional bool reload = 6; //装弹 + optional float fly_distance = 7; //子弹飞行距离(只有手雷和烟雾弹时这个字段才有意义) + + optional int32 select_weapon = 8; //切换武器(没切换是不用发) + optional int32 drop_weapon = 9; //丢弃武器 101:医疗包 102:止痛药 103:肾上腺速 + optional int32 drop_num = 43; //丢弃武器(数量) + + optional bool cancel_action = 10; //取消当前操作(比如取消使用道具装弹等) + optional int32 use_item_idx = 11; //使用道具(对应库存索引0-16) + optional int32 use_item_id = 12; //使用道具 (道具id目前只有伪装) + optional int32 use_scope = 13; //使用倍镜 0-4 + + optional bool interaction = 14; //是否有交互 + repeated int32 interaction_objids = 15; //交互的对象id列表 + optional bool aiming = 16; //是否瞄准中 + + optional bool use_skill = 17; //使用技能 + optional int32 skill_id = 18; //技能id + optional int32 skill_target_id = 19; //技能目标(单体攻击) + optional MFVec3 skill_dir = 20; //技能方向 + optional float skill_distance = 21; //技能目标距离 + optional float skill_param1 = 22; //辅助参数 + + optional bool spectate = 30; //自杀 + + optional int32 emote = 31; //表情id + + optional bool jump = 32; //跳伞 + optional bool get_down = 33; //下车 + /*上车 + loot的uniid或者队友的uniid + 注意:当客户端同时发了下车和上车的时候服务器只处理上车,忽略下车 + */ + optional int32 get_on = 36; + optional int32 switch_seat = 37; //切换座位 + + optional int32 follow = 38; //跟随0:取消跟随 其他:玩家uniid + + optional int32 dive = 39; //下潜 + + optional int32 trace_target_uniid = 41; //自动追踪目标uniid + + repeated int32 hit_fly_effects = 42; //飞行特效命中(飞到目的地)时回传value3 + + optional MFThrow throw_bomb = 44; //投掷 + + optional MFVec3 sand_table_target_pos = 45; //沙盘目标位置 + + optional MFVec3 shot_target_pos = 46; //射击时目标位置(如果没目标则为子弹终点) + optional MFVec3 shot_client_pos = 47; //射击时客户端位置 +} + +//立刻消息 +message CMImmediateMsg +{ + optional int32 stop_move = 1; //停止移动 + optional int32 stop_shot = 2; //停止射击 +} + +//组队标记目标位置 +message CMTeamMarkTargetPos +{ + optional MFVec3 pos = 1; //目标位置,如果不传表示取消 +} + +//执行GM指令 +message CMExecCommand +{ + optional string cmd = 1; //指令 +} + +//丢弃道具 +message CMDropItem +{ + optional int32 item_id = 1; //道具id + optional int32 weapon_idx = 2; //武器索引 0-4 +} + +//发送表情 +message CMEmote +{ + optional int32 type = 1; + optional MFVec3 pos = 2; + optional bool team_only = 4; +} + +//语音 +message CMVoice +{ + optional string download_url = 2; //语音下载地址 +} + +//请求结算 +message CMGameOver +{ +} + +//请求观战 +message CMWatchWar +{ + +} + +//离开 在飞机起飞前视为:逃跑 起飞后视为自杀 +message CMLeave +{ + +} + +//复活死亡后15秒内,如果超过15秒服务器发SMGameOver +message CMRevive +{ + optional int32 target_uniid = 1; //需要复活的对象的uniid 复活自己时候传自己的id +} + +//取消复活 +message CMCancelRevive +{ +} + +//组队匹配-取消 +message CMMatchCancel +{ +} + +//组队匹配-选取英雄 +message CMMatchChoose +{ + optional int32 hero_id = 1; //英雄id + repeated MFWeapon weapons = 2; //武器列表 + repeated MFPair skill_list = 4; //技能列表 key:技能id value:预留给之后扩展,目前传0就行 + optional string hero_uniid = 7; //英雄唯一id +} + +//组队匹配-出击 +message CMMatchStartGame +{ +} + +//组队匹配-出击 +message CMMatchCancelStartGame +{ +} + +//组队匹配-指定成员发送消息 +message CMMatchSendMsg +{ + //成员将收到SMMatchMemberMsgNotify消息 + repeated string target_list = 1; //目标列表,目标收到SMMatchMemberMsgNotify消息 + optional string content = 2; //消息内容 +} + +//组队匹配-队伍内广播消息 +message CMMatchBroadcastMsg +{ + //成员将收到SMMatchMemberMsgNotify消息 + optional int32 exclude_self = 1; //include_self!=0时排除自己 + optional string content = 2; //消息内容 +} + +/* + 请求子弹伤害(追踪型子弹、上报型子弹) +*/ +message CMRequestBulletDmg +{ + optional int32 bullet_uniid = 1; //子弹唯一id + optional int32 shield_hit = 2; //打中盾牌 + optional int32 strengthen_wall_uniid = 3; //能量墙uniid + optional int32 target_uniid = 4; //命中目标id + optional MFVec3 pos = 5; //子弹当前位置 +} + +//请求投掷物伤害 +message CMRequestThrowDmg +{ + optional int32 throw_uniid = 1; //投掷唯一id +} + +//收起盾牌 +message CMStowShield +{ + +} + +//设置复活点 +message CMSetRevivePosition +{ + optional MFVec3 pos = 1; //子弹当前位置 +} + +//获取结算队伍列表 +message CMGetSettlementTeamList +{ +} + +message SMGetSettlementTeamList +{ + repeated MFSettlementTeam2 team_list = 1; //队伍列表 +} + +//endcmmsg + +//观战error_code == 0 时关闭结算界面,回到战斗界面 +message SMWatchWar +{ + optional int32 error_code = 1 [default = 0]; //错误码 0:成功 1:失败 + optional string error_msg = 2; //错误信息 + optional string name = 3; //昵称 +} + +//加入成功 +message SMJoinedNotify +{ + optional int32 team_mode = 1; //队伍模式 0:单人 1:多人 + + optional int32 error_code = 7; //错误 1:服务器维护中 2:服务器繁忙请稍后再进入 + optional int32 error_msg = 10; //错误描述 + + optional string server_info = 9; //服务器信息(重连时使用) 已经废弃移动到SMMapInfo + + optional int32 adjust_bullet = 12; //是否矫正子弹出生点(默认不矫正 1:矫正) + + optional int32 is_newbie_room = 13; //是否新手房间 + + optional int32 pre_client_shot = 14; //是否支持客户端子弹预表现 +} + +//地图信息 +message SMMapInfo +{ + optional int32 map_id = 1; //地图id + optional float map_width = 2; //地图宽度 + optional float map_height = 3; //地图高度 + repeated MFMapObject objects = 6; //地图对象 + optional int32 player_id = 7; //玩家id(自己) + optional bool started = 8; //游戏是否已开始 + optional string room_uuid = 9; //房间唯一id + optional string server_info = 10; //服务器信息(重连时使用) + optional int32 room_mode = 11; //0:吃鸡模式 1:歼灭模式 2:生存模式 3:moba模式 + optional int32 match_mode = 13; //比赛模式 0: pvp 1:排位赛(只有吃鸡模式下该字段才有意义) + optional int32 pve_instance_id = 16; //pve副本id + optional int32 mapid = 17; //地图id之后会删除,目前只给老版本用 + optional int32 side = 18; //moba模式出生点 0:无 1:左侧 2:右侧 +} + +//帧事件 +message SMUpdate +{ + repeated int32 out_objids = 1; //对象-移出视野 + repeated int32 del_objids = 2; //对象-待删除 + repeated MFObjectFull full_objects = 3; //对象-全量(出现在视野) + repeated MFObjectPart part_objects = 4; //对象-部分(用于插值更新) + optional int32 active_player_id = 5; //当前活跃玩家id(如果玩家死亡后是观战对象的id) + optional MFActivePlayerData active_player_data = 6; //活跃玩家数据(如果玩家死亡后是观战对象的数据) + optional int32 gas_progress = 16; //毒圈进度,表示缩进的像素数(只有当gas_data.mode == moving时才会发进度) + optional MFVec3 gas_pos_old = 30; //毒圈当前圆心坐标 + optional MFGasData gas_data = 17; //毒圈数据 + repeated MFTeamData team_data = 18; //队伍数据 + repeated MFBullet bullets = 20; //子弹 + repeated MFShot shots = 21; //射击 + repeated MFExplosion explosions = 22; //爆炸 + repeated MFEmote emotes = 23; //表情 + optional MFAirDrop airdrop = 26; //空投 + optional MFPlane plane = 27; //飞机 + repeated MFBuffChg chged_buff_list = 28; //buff变更列表 + repeated MFEffectChg chged_effect_list = 51; //特效变更列表 + repeated MFPropertyChg chged_property_list = 31; //property变更列表 + repeated MFPlaySkill play_skill_list = 32; //播放技能 + optional MFAirRaid airraid = 33; //空袭 + optional MFSandTable sandtable = 34; //沙盘信息 + + repeated MFTuple dead_alive_objs = 42; //玩家values[0]:objid values[1]:多少毫秒后复活 values[2]: 0:死亡 1:复活 + //一下字段只有僵尸模式才有效 + optional int32 game_left_time = 45; //游戏剩余时间(毫秒, 战斗开始后字段才有意义) + optional int32 frameno = 46; + repeated int32 del_bullets = 47; //子弹删除 + + repeated MFCharacterImage image_objects = 50; //角色形象-本地如果没有full信息则忽略 +} + +//滚动消息 +message SMRollMsg +{ + repeated MFRichTextElement elements = 1; //富文本信息 +} + +//跑马灯消息 +message SMNewsTicker +{ + /* + 1:武器合成 msg_context.values[0]: 昵称 msg_context.values[1]: 武器id + 2:boss出现 msg_context.values[0]: boss唯一id + msg_context.values[1]: boss hero id + msg_context.values[2]: boss x + msg_context.values[3]: boss y + msg_context.values[4]: boss z + msg_context.values[5]: 多久后出现(单位秒) + */ + optional int32 msg_type = 1; //消息类型 + optional MFTupleString msg_content = 2; //消息内容 +} + +//同步对象坐标 +message SMSyncPosition +{ + repeated MFObjPosition obj_list = 1; //对象列表 +} + +//同步队伍数据 +message SMSyncTeamData +{ + repeated MFTeamDataNew team_list = 18; //队伍数据 +} + +//同步击杀信息 +message SMSyncKillList +{ + repeated MFKill kill_list = 18; //击杀列表 +} + +//游戏结束 +message SMGameOver +{ + optional int32 team_id = 1; //队伍id + optional int32 team_rank = 2; //队伍排名 + optional int32 personal_rank = 15; //个人排名 + optional bool game_over = 4; //是否结束 + optional bool victory = 5; //是否胜利 + optional int32 total_human_num = 12; //房间总人数 + optional int32 alive_human_num = 13; //房间剩余存活人数 + optional int32 watchable = 8; //是否可观战 + + repeated MFPlayerStats player_stats = 6; //玩家信息统计 + optional string room_uuid = 7; //房间唯一id + repeated MFTeamData team_data = 10; //队伍数据 + repeated MFTupleString spoils_items = 11; //战利品 0: 道具id 1:道具数量 + + optional MFOverReward reward = 14; //结算奖励 + + optional int32 total_team_num = 16; //本次战斗队伍总数 + optional int32 pve_wave = 17; //pve波次 + optional int32 pve_max_wave = 18; //pve总波次 + optional int32 pve_instance_id = 19; //pve副本id + optional int32 pve_boss_killed = 25; //pve副本boos是否被击杀 + optional int32 map_id = 20; //地图id + + optional int32 mode = 21; //1:个人 2:组队 + optional int32 my_rank = 22; //我的排名 + optional int32 max_rank = 23; //最大排名 + + optional int32 room_mode = 30; //0:吃鸡模式 1:歼灭模式 2:生存模式 + optional int32 match_mode = 32; //比赛模式 0: pvp 1:排位赛(只有吃鸡模式下该字段才有意义) + + optional MFSettlement settlement = 33; //结算信息 + optional MFSettlementNew settlement_new = 34; //结算信息new + + repeated MFPlayerFull victory_team = 35; //吃鸡队伍信息 + optional int32 star_num = 36 [default = 0]; //本次获得的星数 +} + +//离开 +message SMLeave +{ +} + +//取消匹配 +message SMMatchCancel +{ +} + +//断线通知 +message SMDisconnectNotify +{ + optional string reason = 1; //断线原因 +} + +//语音通知 +message SMVoiceNotify +{ + optional string account_id = 2; //唯一id + optional string download_url = 3; //语音下载地址 +} + +//调试信息 +message SMDebugMsg +{ + optional string debug_msg = 3; //调试信息 +} + +//ui界面更新,一些不需要实时更新的数据 +message SMUiUpdate +{ + optional int32 alive_count = 1; //存活数量 + optional int32 kill_count = 2; //击杀数 + repeated MFMapCarInfo car_list = 3; //载具列表 + + //一下只有pve模式有意义 + optional int32 score = 10; //积分 + optional int32 wave = 11; //第几波 + optional int32 max_wave = 12; //总波数 + optional int32 mon_num = 13; // + optional int32 boss_state = 14; //0:boss未出现 1:已出现 2:boss已挂 + + //一下字段只有在moba模式意义 + optional int32 a_team_id = 20; //a队伍id + optional int32 a_kill_count = 21; //a队伍击杀数 + optional int32 b_team_id = 30; //b队伍id + optional int32 b_kill_count = 31; //b队伍击杀数 +} + +//游戏开始 +message SMGameStart +{ +} + +//系统飘字 +message SMSysPiaoMsg +{ + optional string msg = 1; //消息内容 + optional int32 color = 2; //字体颜色rgb + optional int32 duration = 3; //持续时间(毫秒) +} + +//线上倒计时面板 +message SMShowCountdown +{ + optional string msg = 1; //消息内容 + optional int32 countdown = 2; //倒计时(单位秒),倒计时用来替换msg里的%d标识 + optional int32 msg_type = 3; //保留字段 +} + +//显示匹配队伍ui +message SMShowTeamUI +{ +} + +//更新匹配信息 +message SMUpdateMatchInfo +{ + optional MFMatchInfo info = 1; //匹配信息 +} + +//匹配-队伍成员消息 +message SMMatchMemberMsgNotify +{ + optional string sender = 1; //消息发送者 + optional string content = 2; //消息内容 +} + +//获得物品 +message SMGetItemNotify +{ + repeated MFPair old_items = 8; //key:道具id value:数量 + repeated MFTuple items = 1; //0道具id 1:数量 2:当前数量 +} + +//通过了这一波 +message SMPvePassWave +{ + optional int32 new_wave = 17; //新pve波次 + optional int32 pve_max_wave = 18; //pve总波次 + optional int32 wait_time = 2; //下一波开始时间(单位秒) +} + +//组队标记目标位置列表 +message SMTeamMarkTargetPosList +{ + repeated MFTeamMarkPos pos_list = 1; //位置列表 +} + +//调试指令 +message SMDebugCmd +{ + optional string cmd = 1; //指令 + repeated float params = 2; //参数 +} + +//新手战引导结束 +message SMNewBieEnd +{ + repeated MFPlayerFull victory_team = 1; //吃鸡队伍信息 +} diff --git a/server/tools/robot/kcpclient/proto/mt.proto b/server/tools/robot/kcpclient/proto/mt.proto new file mode 100755 index 00000000..b64c7ebe --- /dev/null +++ b/server/tools/robot/kcpclient/proto/mt.proto @@ -0,0 +1,665 @@ +package mt; + +message Parameter +{ + optional string param_name = 1; + optional string param_value = 2; +} + +message Attr +{ + required int32 attr_id = 1; + required string attr_cname = 2; + required string attr_ename = 3; +} + +message Map +{ + optional int32 map_id = 1; + optional string template_list = 2; + optional string map_name = 3; + optional float map_width = 4; + optional float map_height = 5; + optional string airdrops = 6; + optional int32 terminator_airdrop = 7; + optional int32 player = 8; + optional string refresh_robot = 9; + optional int32 map_mode = 10; + optional string safearea = 11; + optional string game_start_buff_list = 12; + optional string map_pic = 13; + optional string first_safearea_center = 14; + optional int32 init_gas_ring = 15; + optional string airraids = 16; + optional string car_num_limit = 17; + optional float scale = 18; + optional string map_collider = 19; + optional string world_object_file = 20; + optional string terrain_file = 21; + optional int32 map_type = 22; + optional int32 team = 23; + optional int32 star_condition = 24; + optional int32 is_open = 25; + optional string ground_sampling_pos = 26; + optional string navmesh_file = 27; + optional int32 moba_time = 28; + optional int32 is_moba = 29; +} + +message MapArea +{ + optional int32 map_id = 1; + optional int32 area_type = 2; + optional int32 area_subtype = 3; + optional string area_center = 4; + optional float area_width = 5; + optional float area_height = 6; +} + +message MapThing +{ + optional int32 thing_id = 1; //物件id + optional int32 thing_type = 16; + optional int32 time = 17; + optional int32 type = 2; //类型 + optional int32 height = 3; //高度 + optional int32 width = 4; //宽度 + optional int32 hp = 5; //生命 + optional float damage = 6; //伤害 + optional float damage_dia = 7; //伤害半径 + optional string drop = 8; //掉落 + optional int32 is_door = 10; //是否门 + optional int32 is_house = 11; //是否房间 + optional int32 is_tree = 12; //是否树 + optional int32 house_id = 13; //房间id + optional string buff_list = 14; + optional int32 explosion_effect = 15; + optional int32 explosion_interval = 18; + optional int32 explosion_dmg_delay = 37; + optional int32 explosion_times = 19; + optional int32 explosion_float = 20; + optional string preexplosion_summon = 35; + optional string monster_list = 21; + optional string special_damage_type = 22; + optional string receive_special_damage_type = 23; + optional string param1 = 24; + optional string param2 = 25; + optional int32 interaction_mode = 26; + optional int32 view_mode = 27; + optional int32 bullet_hit = 28; + optional int32 collision_hit = 29; + optional int32 explosion_hit = 30; + optional string sweep_tags = 31; + optional int32 prebattle_hide = 32; + optional int32 life_time = 33; + optional int32 summon_born_rad = 34; + optional string shapes = 36; + optional int32 delay_destroy = 38; +} + +message SafeArea +{ + optional int32 id = 1; //id + optional int32 level = 2; //安全区登记 + optional int32 rad = 3; //半径 + optional int32 wait_time = 4; //等待时间 + optional int32 shrink_speed = 5; //收缩速度 + optional float hurt = 6; //伤害/秒 + optional int32 type = 7; + optional int32 x1 = 8; + optional int32 y1 = 9; + optional string boss = 10; + optional int32 rebirth = 11; +} + +message SafeAreaSafePoint +{ + optional int32 id = 1; + optional int32 type = 2; + optional float x = 8; + optional float y = 9; + optional float z = 10; +} + +message SafeAreaPos +{ + optional int32 id = 1; + optional int32 x1 = 2; + optional int32 y1 = 3; + optional int32 x2 = 4; + optional int32 y2 = 5; + optional int32 x3 = 6; + optional int32 y3 = 7; + optional int32 x4 = 8; + optional int32 y4 = 9; + optional int32 x5 = 10; + optional int32 y5 = 11; + optional int32 x6 = 12; + optional int32 y6 = 13; + optional int32 x7 = 14; + optional int32 y7 = 15; + optional int32 x8 = 16; + optional int32 y8 = 17; + optional int32 x9 = 18; + optional int32 y9 = 19; + optional int32 x10 = 20; + optional int32 y10 = 21; +} + +message Item +{ + optional int32 id = 1; + optional int32 type = 2; + optional int32 sub_type = 3; + optional int32 quality = 4; + optional int32 use = 5; + optional int32 skinid = 6; + optional int32 isdefaultskin = 7; + optional int32 playerid = 8; + optional int32 relationship = 9; + optional string name = 10; +} + +message Equip +{ + optional int32 id = 1; //装备id + optional int32 equip_type = 2; //装备类型 + optional int32 equip_subtype = 3; //装备子类型 + optional int32 equip_lv = 4; //装备等级 + optional int32 fire_mode = 5; //开火模式 + optional int32 use_bullet = 6; //使用子弹 + optional int32 clip_volume = 7; //弹夹数量 + optional int32 reload_time = 8; //装弹时间 + optional int32 fire_rate = 9; //武器射速 + optional string atk = 10; //攻击力 + optional int32 def = 11; //防御力 + optional string max_hp = 41; + optional int32 explosion_range = 12; //子弹爆炸范围 + optional int32 bullet_speed = 13; //子弹速度 + optional int32 range = 14; //射程 + optional int32 use_time = 15; //使用时间 + optional string heal = 16; //瞬间生命恢复 + optional int32 time = 17; //时间 + optional string volume = 19; //装备容量 + optional int32 bullet_rad = 20; //子弹半径 + optional int32 group_num = 21; //每组数量 + optional int32 is_luck = 22; //是否吉利服 + optional string bullet_born_offset = 30; //子弹出生偏移 + optional float bullet_angle = 34; //子弹浮动方向 + optional string name = 35; //装备名字 + optional float rad = 36; //半径 + optional float rad2 = 37; + optional int32 buffid = 38; + optional int32 drop_id = 40; + optional int32 explosion_effect = 42; + optional string param1 = 43; + optional string param2 = 44; + optional int32 reloadtype = 46; + optional float recoil_force = 47; + optional int32 missiles_time = 48; + optional int32 heroid = 49; + optional string launch_dev = 50; + optional string power_time = 51; + optional string power_gun = 52; + optional string power_buff = 53; + optional int32 through_teammate = 54; + optional string text_icon = 55; + optional string special_damage_type = 56; + optional float max_oil = 57; + optional float average_oil = 58; + optional float atk_mech = 59; + optional int32 use_scene = 60; + optional int32 ispenetrate = 61; + optional int32 is_penetrate_thing = 62; + optional int32 reload_delay_time = 63; + optional int32 cast_time = 64; + optional int32 aiming_cast_time = 80; + optional int32 auto_switch_weapon_time = 65; + optional int32 quality = 66; + optional int32 explosion_damage_delay = 67; + optional int32 bullet_consume_type = 68; + + optional string inventory_slot = 31; + optional int32 _inventory_slot = 32; + + optional float critical = 70; + optional float cri_damage = 71; + + optional int32 shootfire = 73; + optional string hit_buff = 75; + + optional int32 auto_trace = 76; + optional int32 trace_range = 77; + + optional int32 double_gun = 78; +} + +message Hero +{ + optional int32 id = 1; //唯一id + optional float radius = 2; //半径 + + optional float move_speed = 4; //移动速度 + optional float jump_speed = 5; //跳伞速度 + optional float fall_speed = 6; + optional float aim_speed = 8; + optional float shoot_speed = 7; + optional float reload_speed = 9; + optional float medicine_speed = 10; //移动速度4 + optional float swim_speed = 49; + + optional string volume = 12; //初始库存 + optional int32 level = 13; + optional int32 race = 14; + optional string name = 23; + optional float hit_offset_x = 42; + optional float hit_offset_y = 43; + optional float hit_radius = 25; + optional string ai_script = 26; + optional string init_buffs = 27; + optional int32 default_weapon = 28; + optional string dead_drop = 29; + optional int32 delay_delete = 39; + optional int32 ai = 46; + optional int32 delay_remove = 47; + optional int32 skinlist = 48; + optional string pre_appear_effect = 50; + + optional string pve_score = 51; + + optional int32 hp = 52; + optional int32 damage = 53; + optional int32 defence = 54; + optional float crit_atk = 55; + optional float crit_atk_ratio = 56; + optional float miss = 57; + optional float miss_damage_ruduce = 58; + + optional int32 skill1list = 60; + optional int32 skill2list = 61; + optional int32 skill3list = 62; + + optional float hp_ratio = 63; + optional float damage_ratio = 64; + optional float defence_ratio = 65; + + optional string bt = 70; + + optional string drop = 71; + optional string new_bt = 72; +} + +message Robot +{ + optional int32 id = 1; + optional string name = 2; + optional int32 hero_id = 3; + optional string skin_id = 10; + optional int32 weapon_id = 4; + optional int32 weapon_lv = 5; + + optional int32 sex = 8; + optional float dmg_ratio = 20; + optional string bullet_offset = 21; +} + +message Skill +{ + required int32 skill_id = 1; + required int32 skill_type = 2; + required string value_up = 6; + required int32 skill_cd = 7; + required int32 skill_target = 8; + required string buff_list = 9; + required float skill_distance = 10; + required int32 cold_time_up = 11; + required int32 max_times = 12; + + optional int32 phase1_time_offset = 20; + optional int32 phase1_func = 21; + optional string phase1_param1 = 22; + optional string phase1_param2 = 23; + optional string phase1_param3 = 24; + + optional int32 phase2_time_offset = 30; + optional int32 phase2_func = 31; + optional string phase2_param1 = 32; + optional string phase2_param2 = 33; + optional string phase2_param3 = 34; + + optional int32 phase3_time_offset = 40; + optional int32 phase3_func = 41; + optional string phase3_param1 = 42; + optional string phase3_param2 = 43; + optional string phase3_param3 = 44; + optional int32 cast_time = 45; + + optional int32 up_exp = 50; + optional int32 nextlv_skill = 51; + + optional int32 attack_dir_lock_time = 52; +} + +message SkillNumber +{ + required int32 skill_id = 1; + optional int32 skill_type = 2; + optional float number = 3; + optional float damage = 4; + optional float damage_addition = 5; + optional float damage_change = 6; + optional float shield = 7; + optional float shield_addition = 8; + optional float resume = 9; + optional float resume_addition = 10; + optional string speed = 11; + optional string range = 12; + optional string range2 = 13; + optional string range3 = 21; + optional string range4 = 23; + optional string range5 = 24; + optional string range6 = 25; + optional string time = 14; + optional string cd = 15; + optional int32 buff_id = 16; + optional float buff_time = 17; + optional string probability = 18; + optional int32 explosion_effect = 19; + optional string effect_list = 20; + optional string time2 = 22; + optional string time3 = 40; + optional string time4 = 41; + optional string time5 = 42; + optional string time6 = 43; +} + +message NpcStandard +{ + required int32 id = 1; + optional int32 quality = 2; + optional int32 hp = 3; + optional int32 damage = 4; + optional int32 defence = 5; + optional int32 hero_id = 6; + optional int32 level = 7; +} + +message Buff +{ + required int32 buff_id = 1; + required string name = 20; + required int32 buff_target = 2; + required int32 buff_effect = 3; + required int32 trigger_type = 4; + required string buff_param1 = 6; + required string buff_param2 = 7; + required string buff_param3 = 8; + required string buff_param4 = 9; + optional string buff_param5 = 19; + optional string buff_param6 = 37; + optional string buff_param7 = 38; + optional string buff_param8 = 39; + required string duration_time = 10; + optional float buff_valueup = 11; + required string immune_buffeffect_list = 12; + optional string post_remove_action = 13; + optional int32 only_server = 14; + optional int32 only_self = 15; + optional int32 depend_effect = 16; + optional string child_buff = 17; + optional int32 coexist_num = 18; + optional int32 dead_valid = 23; + optional string buff_interval = 24; + optional string tag = 25; + optional int32 post_battle_valid = 26; + optional string only_spec_race = 27; + optional string exclude_spec_race = 28; + optional int32 dead_remove = 29; + optional int32 no_immune = 30; + optional int32 lock_move = 31; + optional int32 lock_dir = 34; + optional int32 lock_move_dir = 36; + optional int32 disable_shot = 32; + optional int32 disable_useskill = 33; + optional string effect_list = 35; + optional string res_scale = 41; + optional int32 tenacity = 40; +} + +message Drop +{ + optional int32 drop_id = 1; + optional string item_id = 2; + optional string num = 3; + optional string weight = 4; + optional int32 type = 5; +} + +message AirDrop +{ + optional int32 id = 1; + optional int32 time = 2; + optional int32 appear_time = 3; + optional string drop_id = 4; +} + +message AirRaid +{ + optional int32 id = 1; + optional int32 time = 2; + optional int32 appear_time = 3; + optional string bomb_id = 4; + optional string raid_wave = 5; + optional float rad = 6; + optional string bombling_time = 7; + optional float damage = 8; +} + +message AirLine +{ + optional int32 id = 1; + optional string start_point = 2; + optional string end_point = 3; + optional float plane_speed = 4; + optional int32 weight = 5; + optional int32 map_id = 6; +} + +message RankReward +{ + optional int32 rank = 1; + optional float parameter = 2; + optional int32 drop = 3; +} + +message RankPoint +{ + optional int32 rank = 1; + optional int32 parameter = 2; + optional int32 parameter2 = 3; + optional int32 parameter3 = 4; +} + +message KillReward +{ + optional int32 kill_num = 1; + optional float parameter = 2; +} + +message KillPoint +{ + optional int32 kill_num = 1; + optional int32 parameter = 2; + optional int32 parameter2 = 3; +} + +message AI +{ + optional int32 id = 13; + //optional int32 ai_level = 1; + optional int32 pursuit_radius = 2; + optional int32 attack_interval = 3; + optional int32 attack_times = 4; + optional int32 attack_type = 5; + optional int32 shot_offset_angle = 6; + optional string random_move_idle_time = 8; + optional string random_move_time = 9; + optional int32 attack_range = 10; + optional float attack_rate = 11; + optional int32 ai_mode = 12; + optional int32 ai_kind = 14; + optional string param1 = 15; + optional string param2 = 16; + optional string param3 = 17; + optional string param4 = 18; + optional string param5 = 19; + optional int32 peace_time = 20; +} + +message Text +{ + optional string textid = 1; + optional string text = 2; +} + +message GunTalentGrow +{ + optional int32 id = 1; + optional int32 talent_id = 2; + optional int32 talent_lv = 3; + optional int32 addtype = 4; + optional string addattr = 5; +} + +message HeroQuality +{ + optional int32 id = 1; + optional int32 quality = 2; + optional int32 gold_limit = 3; + optional int32 lucky = 4; +} + +message GunQuality +{ + optional int32 id = 1; + optional int32 quality = 2; + optional int32 gold_limit = 3; + optional int32 lucky = 4; +} + +message FormulaPvp +{ + optional float top = 1; + optional float ranked_topx = 2; + optional float kills_topx = 3; + optional float hero_topx = 4; + optional float weapon_topx = 5; + optional float survival_topx = 6; +} + +message PveGemini +{ + optional int32 gemini_id = 1; + optional int32 gemini_lv = 2; + optional int32 gemini_limit = 3; + optional string multiplayer_enemy_hp_mul = 4; + optional string born_point = 5; +} + +message PveGeminiContent +{ + optional int32 id = 1; + optional int32 mode_id = 2; + optional int32 round = 3; + optional string spawn_point = 4; + optional string enemy_id = 5; +} + +message PveGeminiMode +{ + optional int32 id = 1; + optional int32 map_id = 2; + optional string mode_time = 3; + optional string area = 4; + optional string score_reward = 5; + optional string round_score = 7; + optional string next_door = 6; + optional int32 wave_prepare_time = 8; +} + +message RankRoom +{ + optional int32 id = 1; + optional int32 elo_min = 2; + optional int32 elo_max = 3; + optional int32 elo_expansion1 = 4; + optional int32 elo_expansion2 = 5; + optional int32 expand_time1 = 6; + optional int32 expand_time2 = 7; + optional int32 player_num_standard = 8; + optional int32 final_time = 9; + optional int32 final_player_num = 10; +} + +message Grasp +{ + optional int32 grasp_id = 1; + optional int32 hero_id = 2; + optional int32 hero_lv = 3; + optional int32 graspbuff_id1 = 4; + optional int32 graspbuff_id1_floor2 = 5; + optional int32 graspbuff_id2 = 6; + optional int32 weapon_id = 7; + optional string add_buff_list = 8; + optional string remove_buff_list = 9; +} + +message GraspBuff +{ + optional int32 graspbuff_id = 1; + optional int32 graspbuff_floor = 2; + optional string graspbuff_trigger = 4; + optional int32 graspbuff_target = 5; + optional string graspbuff_time = 6; + optional int32 attr_id = 7; + optional int32 attr_add_pattern = 8; + optional int32 attr_add_pattern2 = 9; + optional string attr_num = 10; + optional string effect_list = 11; +} + +message GuideStep +{ + optional int32 id = 1; + optional int32 target = 2; + optional string param1 = 3; + optional string param2 = 4; + optional string param3 = 5; + optional string param4 = 6; +} + +message WorldObject +{ + optional int32 object_id= 1; + optional int32 object_type = 2; + optional float x = 3; + optional float y = 4; + optional float z = 5; +} + +message MergeItem +{ + optional int32 equip_id = 1; + optional int32 skill_id = 2; + optional string pickup3 = 3; + optional string pickup6 = 4; + optional string pickup9 = 5; +} + +message MapThingGroup +{ + optional int32 mtGroupId = 1; + optional string rule = 2; + optional string mapThings = 3; + optional string heroes = 4; +} \ No newline at end of file diff --git a/server/tools/robot/kcpclient/proto/navmesh.proto b/server/tools/robot/kcpclient/proto/navmesh.proto new file mode 100644 index 00000000..1dcfdb54 --- /dev/null +++ b/server/tools/robot/kcpclient/proto/navmesh.proto @@ -0,0 +1,29 @@ +syntax = "proto2"; +package navmesh; + +message HeightList{ + required int32 width = 1; + required int32 height = 2; + repeated HeightData datas = 3; +} +message HeightData{ + required int32 x = 1; + required int32 y = 2; + optional int32 endx = 3; + repeated HeightInfo infos = 4; +} + +message HeightInfo{ + optional int32 t = 1; + required int32 h = 2; +} + +message vector3{ + required float x = 1; + required float y = 2; + required float z = 3; +} +message vertex{ + repeated vector3 vectors = 1; + repeated int32 triangles = 2; +} diff --git a/server/tools/robot/kcpclient/proto/out/cs_msgid.proto b/server/tools/robot/kcpclient/proto/out/cs_msgid.proto new file mode 100644 index 00000000..71e8ebb2 --- /dev/null +++ b/server/tools/robot/kcpclient/proto/out/cs_msgid.proto @@ -0,0 +1,61 @@ +package cs; + +enum CMMessageId_e +{ + _CMPing = 101; + + _CMJoin = 103; + _CMReconnect = 104; + _CMMove = 201; + _CMEmote = 204; + _CMVoice = 206; + _CMGameOver = 207; + _CMWatchWar = 208; + _CMLeave = 209; + _CMRevive = 210; + _CMCancelRevive = 211; + _CMAdStart = 212; + _CMAdCancel = 213; + _CMAdEnd = 214; + _CMGetBoxInfo = 215; + _CMOpenBox = 216; + _CMExecCommand = 217; + _CMMatchCancel = 218; + _CMMatchChoose = 219; + _CMMatchStartGame = 220; + _CMMatchCancelStartGame = 221; + _CMMatchSendMsg = 222; + _CMMatchBroadcastMsg = 223; +} + +enum SMMessageId_e +{ + _SMPing = 101; + _SMRpcError = 102; + _SMReconnect = 104; + + _SMWatchWar = 208; + _SMLeave = 209; + _SMGetBoxInfo = 216; + _SMOpenBox = 217; + + _SMJoinedNotify = 103; + _SMMapInfo = 1002; + _SMPlayerInfo = 1003; + _SMUpdate = 1004; + _SMRollMsg = 1005; + _SMPickup = 1006; + _SMVoiceNotify = 1007; + _SMDisconnectNotify = 1008; + _SMGameOver = 1009; + _SMDebugMsg = 1010; + _SMWxVoip = 1011; + _SMUiUpdate = 1012; + _SMGameStart = 1013; + _SMSysPiaoMsg = 1014; + _SMShowCountdown = 1015; + _SMShowTeamUI = 1016; + _SMUpdateMatchInfo = 1017; + _SMGetItemNotify = 1018; + _SMMatchMemberMsgNotify = 1019; +} diff --git a/server/tools/robot/kcpclient/proto/out/cs_proto.proto b/server/tools/robot/kcpclient/proto/out/cs_proto.proto new file mode 100644 index 00000000..2b3829da --- /dev/null +++ b/server/tools/robot/kcpclient/proto/out/cs_proto.proto @@ -0,0 +1,1157 @@ +package cs; + + +enum Constant_e +{ + ProtoVersion = 2022032201; +} + +message CMPing +{ +} +message SMPing +{ + optional int32 param1 = 1; +} + +message SMRpcError +{ + optional int32 error_code = 1; + optional string error_msg = 2; + optional string debug_msg = 3; + optional string file = 4; + optional int32 lineno = 5; + optional int32 error_param = 6; +} + +message MFPair +{ + optional int32 key = 1; + optional int32 value = 2; +} + +message MFPair64 +{ + optional int64 key = 1; + optional int64 value = 2; +} + +message MFTuple +{ + repeated int32 values = 1; +} + +message MFVec2 +{ + optional float x = 1; + optional float y = 2; +} + +message MFPropertyChg +{ + optional int32 obj_id = 1; + optional int32 property_type = 2; + optional int32 property_subtype = 3; + optional float value = 4; +} + +message MFCollider +{ + optional int32 shape = 1; + optional int32 width = 2; + optional int32 height = 3; +} + +message MFMapObject +{ + optional int32 object_id = 1; + optional MFVec2 pos = 2; +} + +message MFPlayerInfo +{ + optional int32 player_id = 1; + optional int32 team_id = 2; + optional string name = 3; +} + +message MFGoods +{ + optional string name = 1; + optional int32 num = 2; +} + +message MFPlug +{ + optional string name = 1; + optional int32 id = 2; + optional int32 param = 3; +} + +message MFWeapon +{ + optional int32 weapon_id = 1; + optional int32 weapon_lv = 2; + optional string weapon_uniid = 3; + optional int32 ammo = 4; + optional int32 volume = 5; +} + +message MFSkin +{ + optional int32 skin_id = 1; + optional int32 skin_lv = 2; +} + +message MFPlayerPart +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional MFVec2 dir = 3; + optional float speed = 4; +} + +message MFAttrAddition +{ + optional int32 attr_id = 1; + optional float abs_val = 2; + optional float rate_val = 3; +} + +message MFPlayerFull +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional MFVec2 dir = 3; + optional int64 guild_id = 4; + + optional float max_health = 5; + optional float health = 6; + optional bool dead = 7; + optional bool downed = 8; + optional bool disconnected = 9; + optional int32 anim_type = 10; + optional int32 anim_seq = 11; + + + repeated MFSkin skin = 13; + optional int32 backpack = 14; + optional int32 helmet = 16; + optional int32 chest = 17; + optional MFWeapon weapon = 18; + optional int32 energy_shield = 19; + optional int32 vip = 20; + optional int32 sdmg = 21; + optional int32 max_energy_shield = 22; + repeated MFBodyState states = 23; + optional int32 kill_count = 24; + optional int32 emoji1 = 25; + optional int32 emoji2 = 26; + optional int32 parachute = 27; + repeated MFBuff buff_list = 28; + optional int32 car_uniid = 29; + optional int32 car_seat = 34; + + optional bool can_revive = 30; + optional int32 revive_countdown = 31; + optional string killer_name = 32; + optional int32 killer_id = 33; + + optional int32 vip_lv = 35 [default = 0]; + optional int32 head_frame = 36 [default = 0]; + optional int32 sex = 37 [default = 0]; + + repeated MFSkill skill_list = 38; + + repeated MFAttrAddition attr_addition= 61; + optional int32 follow_target = 62 [default = 0]; + + optional int32 charid = 44; + optional float speed = 45; + + optional float shoot_offset_x = 50 [default = 0]; + optional float shoot_offset_y = 51 [default = 0]; + + optional string user_data = 60 [default = ""]; +} + +message MFObstaclePart +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional float scale = 3; +} + +message MFObstacleFull +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional float scale = 3; + + optional int32 born_frameno = 4 [default = 0]; + + optional int32 obstacle_id = 6; + optional float health = 7; + optional bool dead = 8; + optional bool dead_at_thisframe = 9; + + optional bool is_door = 20; + + + optional int32 door_id = 22; + optional int32 door_old_state = 23; + optional int32 door_new_state = 24; + optional int32 door_house_uniid = 25; + optional int32 door_house_id = 26; + optional float door_width = 27; + optional float door_height = 28; + optional int32 door_open_times = 29; + optional string button_name = 30; + optional MFCollider collider = 31; +} + +message MFBuildingPart +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; +} + +message MFBuildingFull +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional int32 building_id = 3; + + optional bool ceiling_dead = 6; +} + +message MFLootSpawnerPart +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional int32 loot_id = 3; +} + +message MFLootSpawnerFull +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional int32 loot_id = 3; +} + +message MFLootPart +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; +} + +message MFLootFull +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional MFVec2 born_pos = 3; + optional bool show_anim = 4; + + optional int32 item_id = 6; + optional int32 count = 7; + optional int32 age_ms = 8; + optional int32 item_level = 9 [default = 1]; +} + +message MFDeadBodyPart +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; +} + +message MFDeadBodyFull +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional int32 player_id = 3; + + optional int32 inkjet = 6; +} + +message MFDecalPart +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional int32 decal_id = 3; +} + +message MFDecalFull +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional int32 decal_id = 3; +} + +message MFProjectilePart +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional float pos_z = 3; +} + +message MFProjectileFull +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional float pos_z = 3; +} + +message MFHeroPart +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional MFVec2 dir = 3; + +} + +message MFHeroFull +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional MFVec2 dir = 3; + optional int32 heroid = 4; + optional int32 master_uniid = 5; + optional float health = 10; + optional bool dead = 11; + repeated MFBuff buff_list = 12; + optional float max_health = 13; +} + +message MFSmokePart +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional float rad = 3; +} + +message MFSmokeFull +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional float rad = 3; +} + +message MFCarPart +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional MFVec2 dir = 3; +} + +message MFCarFull +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional MFVec2 dir = 3; + optional int32 car_id = 4; + optional int32 driver = 5; + optional int32 heroid = 7; + optional float health = 10; + optional bool dead = 11; + repeated MFBuff buff_list = 12; + optional float max_health = 13; + optional int32 oil = 14; + optional int32 max_oil = 15; + optional int32 bullet_num = 16; + + repeated MFPlayerFull passengers = 6; + optional int32 seat_num = 17; + optional int32 born_frameno = 8; +} + +message MFObjectPart +{ + + optional int32 object_type = 1; + + optional MFPlayerPart union_obj_1 = 2; + optional MFObstaclePart union_obj_2 = 3; + optional MFBuildingPart union_obj_3 = 4; + optional MFLootSpawnerPart union_obj_4 = 5; + optional MFLootPart union_obj_5 = 6; + optional MFDeadBodyPart union_obj_6 = 7; + optional MFDecalPart union_obj_7 = 8; + optional MFProjectilePart union_obj_8 = 9; + optional MFSmokePart union_obj_9 = 10; + optional MFHeroPart union_obj_10 = 11; + optional MFCarPart union_obj_11 = 12; +} + +message MFObjectFull +{ + + optional int32 object_type = 1; + + optional MFPlayerFull union_obj_1 = 2; + optional MFObstacleFull union_obj_2 = 3; + optional MFBuildingFull union_obj_3 = 4; + optional MFLootSpawnerFull union_obj_4 = 5; + optional MFLootFull union_obj_5 = 6; + optional MFDeadBodyFull union_obj_6 = 7; + optional MFDecalFull union_obj_7 = 8; + optional MFProjectileFull union_obj_8 = 9; + optional MFSmokeFull union_obj_9 = 10; + optional MFHeroFull union_obj_10 = 11; + optional MFCarFull union_obj_11 = 12; + + optional int32 obj_uniid = 14; + optional int32 object_flags = 15; +} + +message MFActivePlayerData +{ + optional int32 action_type = 3; + optional int32 action_duration = 5; + optional int32 action_item_id = 6; + optional int32 action_target_id = 7; + optional int32 action_frameno = 1; + + repeated MFPair items = 8; + + repeated MFSkin skin = 30; + optional int32 backpack = 31; + optional int32 helmet = 32; + optional int32 chest = 33; + + optional float max_health = 34; + optional float health = 35; + + optional int32 cur_scope = 10; + repeated int32 inventory = 11; + + optional int32 cur_weapon_idx = 15; + repeated MFWeapon weapons = 16; + + optional int32 energy_shield = 40; + optional int32 max_energy_shield = 41; + + optional int32 spectator_count = 20; + repeated MFBodyState states = 27; + + repeated MFSkill skill_list = 28; + + repeated MFAttrAddition attr_addition= 61; + optional string name = 62; + + optional float shoot_offset_x = 50 [default = 0]; + optional float shoot_offset_y = 51 [default = 0]; + + optional int32 dive_oxygen_max = 63; + optional int32 dive_oxygen_curr = 64; +} + +message MFGasData +{ + optional int32 mode = 1; + optional float duration = 2; + optional MFVec2 pos_old = 3; + optional MFVec2 pos_new = 4; + optional float rad_old = 5; + optional float rad_new = 6; +} + +message MFTeamData +{ + optional int32 team_id = 61; + optional int32 player_id = 1; + optional MFVec2 pos = 2; + optional MFVec2 dir = 3; + optional float health = 4; + optional bool disconnected = 5 [default = false]; + optional bool dead = 6 [default = false]; + optional bool downed = 7 [default = false]; + optional string name = 8; + optional float max_health = 9; + optional bool riding = 40 [default = false]; + optional string user_data = 60 [default = ""]; + optional int32 can_follow = 62 [default = 0]; + + + optional string account_id = 10; + optional string avatar_url = 11; + optional int64 user_value1 = 31; + optional int64 user_value2 = 32; + optional int64 user_value3 = 33; + optional int64 guild_id = 34; + optional int32 vip_lv = 35 [default = 0]; + optional int32 head_frame = 36 [default = 0]; + optional int32 sex = 37 [default = 0]; + repeated MFSkin skin = 39; +} + +message MFBullet +{ + optional int32 player_id = 1; + optional int32 bullet_id = 2; + optional MFVec2 pos = 3; + optional MFVec2 dir = 4; + optional int32 gun_lv = 5; + optional int32 bulletskin = 6; + optional bool crit = 7; + optional int32 reflect_count = 8; + optional int32 reflect_objid = 9; + optional int32 gun_id = 10; + optional float fly_distance = 11; + optional int32 bullet_uniid = 12; +} + +message MFShot +{ + optional int32 player_id = 1; + optional MFWeapon weapon = 2; + optional bool offhand = 3; + optional int32 bullskin = 4; + optional int32 hole = 5 [default = 0]; +} + +message MFExplosion +{ + optional int32 item_id = 1; + optional MFVec2 pos = 2; + optional int32 player_id = 3; + optional int32 effect = 4 [default = 0]; +} + +message MFSmoke +{ + optional int32 item_id = 1; + optional MFVec2 pos = 2; + optional int32 player_id = 4; + optional float time_addition = 5; +} + +message MFEmote +{ + optional int32 emote_id = 1; + optional int32 player_id = 3; + optional string msg = 5; +} + +message MFHeroStats +{ + optional string hero_uniid = 1 [default = ""]; + optional string hero_name = 2 [default = ""]; + optional int32 hero_id = 3 [default = 0]; + optional int32 reward_ceg = 4 [default = 0]; + optional int32 ceg_uplimit = 5 [default = 0]; + optional int32 today_get_ceg = 6 [default = 0]; +} + +message MFWeaponStats +{ + optional string weapon_uniid = 1 [default = ""]; + optional string weapon_name = 2 [default = ""]; + optional int32 weapon_id = 3 [default = 0]; + optional int32 reward_ceg = 4 [default = 0]; + optional int32 ceg_uplimit = 5 [default = 0]; + optional int32 today_get_ceg = 6 [default = 0]; +} + +message MFPlayerStats +{ + optional int32 player_id = 1; + optional string player_avatar_url = 2; + + + optional int32 time_alive = 3; + optional int32 kills = 4; + optional int32 damage_amount = 8; + optional int32 heal_amount = 20; + + optional int32 history_time_alive = 30; + optional int32 history_kills = 31; + optional int32 history_damage_amount = 32; + optional int32 history_heal_amount = 33; + + optional int32 gold = 10; + optional int32 score = 11; + repeated MFPair items = 6; + optional int32 pass_score = 9; + optional int32 rank_score = 13; + optional bool has_pass = 27; + + repeated MFPair extra_drop = 12; + + optional bool dead = 5; + optional int32 killer_id = 7; + optional string killer_name = 40; + optional string killer_avatar_url = 41; + optional string killer_account_id = 42; + + optional string account_id = 21; + optional int64 guild_id = 22; + optional int32 rescue_guild_member = 23; + + optional int32 vip_lv = 35 [default = 0]; + optional int32 head_frame = 36 [default = 0]; + optional int32 sex = 37 [default = 0]; + optional int32 charid = 38; + optional int32 team_id = 39; + optional string nickname = 43; + + repeated MFSkin skin = 45; + + optional MFHeroStats hero_stats = 46; + repeated MFWeaponStats weapons_stats = 47; +} + +message MFAirDrop +{ + optional int32 appear_time = 1; + optional int32 box_id = 2; + optional MFVec2 pos = 3; +} + +message MFAirRaid +{ + optional int32 appear_time = 1; + optional MFVec2 pos = 3; + optional float rad = 4; +} + +message MFBuff +{ + optional int32 buff_id = 1; + optional float left_time = 2; + optional float lasting_time = 3; + repeated float params = 4; + optional int32 buff_uniid = 5; +} + +message MFBuffChg +{ + optional int32 obj_id = 1; + optional int32 chg = 2; + optional MFBuff buff = 3; +} + +message MFBodyState +{ + optional int32 state_type = 1; + optional float left_time = 2; + optional float lasting_time = 3; +} + +message MFPlane +{ + optional MFVec2 start_point = 1; + optional MFVec2 end_point = 2; + optional MFVec2 pos = 3; +} + +message MFMapCarInfo +{ + optional int32 car_id = 1; + optional MFVec2 pos = 2; +} + +message MFTeamMember +{ + optional string account_id = 1; + optional int32 rank = 2; + optional bool is_leader = 3; + optional int32 game_times = 4; + optional int32 win_times = 5; + optional int32 kill_times = 6; + optional int32 create_time = 7; +} + +message MFPosition +{ + optional int32 obj_uniid = 1; + optional MFVec2 pos = 2; + optional MFVec2 dir = 3; + optional int32 race = 4; +} + +message MFSkill +{ + optional int32 skill_id = 1; + optional int32 left_time = 2; + optional int32 cd_time = 3; + optional int32 curr_times = 4; + optional int32 max_times = 5; + optional int32 exp = 7; + optional int32 max_exp = 8; +} + +message MFPlaySkill +{ + optional int32 obj_uniid = 1; + optional int32 skill_id = 2; +} + +message MFTextElement +{ + optional string text = 1; + optional int32 color = 2 [default = 0xFFFFFF]; +} + +message MFImageElement +{ + optional int32 id = 1; +} + +message MFRichTextElement +{ + + optional int32 element_type = 1; + optional MFTextElement union_obj_1 = 2; + optional MFImageElement union_obj_2 = 3; +} + +message MFMatchTeamMember +{ + optional string account_id = 1; + optional string name = 2; + optional string avatar_url = 3; + optional int32 hero_id = 4; + repeated MFWeapon weapons = 5; + repeated MFSkin skins = 6; + repeated MFPair skill_list = 7; + optional bool is_leader = 8; + optional int32 state = 9; + optional int32 head_frame = 10; + repeated int32 baseskin = 11; + optional int32 hero_skin = 12; +} + +message MFMatchInfo +{ + repeated MFMatchTeamMember members = 1; + optional int32 phase = 2; + optional int32 countdown = 3; + optional int32 predict_time = 4; +} + +message MFOverRewardItem +{ + optional int32 obtain_gold = 1; + optional int32 gold_limit = 2; +} + +message MFOverReward +{ + optional MFOverRewardItem hero = 1; + optional MFOverRewardItem weapon1 = 2; + optional MFOverRewardItem weapon2 = 3; + optional int32 bounds = 4; + optional int32 total = 5; +} + + +message CMJoin +{ + optional int32 server_id = 1; + optional string team_uuid = 2; + optional string account_id = 3; + optional int32 team_mode = 4; + optional int32 proto_version = 5; + optional bool auto_fill = 6; + optional int32 bot = 7; + optional string name = 8; + optional bool use_touch = 9; + repeated int32 emotes = 10; + optional string avatar_url = 11; + optional int32 energy_shield = 12; + repeated int32 baseskin = 13; + optional int32 basemelee = 14; + repeated int32 buff_list = 15; + repeated MFWeapon weapons = 17; + repeated MFSkin skins = 18; + repeated int32 prepare_items = 19; + repeated MFPair prepare_items2 = 29; + optional string session_id = 20; + optional string from_appid = 21; + optional float atk_add = 22; + optional string pre_settlement_info = 23; + optional int32 emoji1 = 24; + optional int32 emoji2 = 25; + optional int32 parachute = 26; + optional bool has_pass = 27; + optional int32 today_enter_times = 28; + repeated MFWeapon grow_weapons = 30; + optional int64 user_value1 = 31; + optional int64 user_value2 = 32; + optional int64 user_value3 = 33; + optional int64 guild_id = 34; + optional int32 vip_lv = 35 [default = 0]; + optional int32 head_frame = 36 [default = 0]; + optional int32 sex = 37 [default = 0]; + optional bool force_entry_newbie_room = 50; + repeated MFTeamMember team_members = 51; + optional int32 room_mode = 52; + optional int32 mapid = 53; + repeated MFPair skill_list = 54; + optional string user_data = 60 [default = ""]; + optional int32 hero_id = 61; + repeated MFPair talent_list = 64; + optional int32 show_team_ui = 62; + optional int32 hero_skin = 63; + optional string pre_battle_payload = 70; + + optional string hero_uniid = 71; +} + +message CMReconnect +{ + optional int32 server_id = 1; + optional string team_uuid = 2; + optional string account_id = 3; + optional string session_id = 4; + optional string room_uuid = 5; + optional string server_info = 6; +} + +message SMReconnect +{ + optional int32 errcode = 1; + optional string errmsg = 2; +} + +message CMMove +{ + optional int32 seq = 1; + + optional MFVec2 move_dir = 2; + optional MFVec2 attack_dir = 3; + + optional bool shot_start = 4; + optional bool shot_hold = 5; + optional bool reload = 6; + optional float fly_distance = 7; + + optional int32 select_weapon = 8; + optional int32 drop_weapon = 9; + + optional bool cancel_action = 10; + optional int32 use_item_idx = 11; + optional int32 use_item_id = 12; + optional int32 use_scope = 13; + + optional bool interaction = 14; + repeated int32 interaction_objids = 15; + optional bool aiming = 16; + + optional bool use_skill = 17; + optional int32 skill_id = 18; + optional int32 skill_target_id = 19; + optional MFVec2 skill_dir = 20; + optional float skill_distance = 21; + optional float skill_param1 = 22; + + optional bool spectate = 30; + + optional int32 emote = 31; + + optional bool jump = 32; + optional bool get_down = 33; + optional int32 get_on = 36; + optional int32 switch_seat = 37; + + optional int32 follow = 38; + + optional int32 dive = 39; +} + +message CMExecCommand +{ + optional string cmd = 1; +} + +message CMDropItem +{ + optional int32 item_id = 1; + optional int32 weapon_idx = 2; +} + +message CMEmote +{ + optional int32 type = 1; + optional MFVec2 pos = 2; + optional bool team_only = 4; +} + +message CMVoice +{ + optional string download_url = 2; +} + +message CMGameOver +{ +} + +message CMWatchWar +{ + +} + +message CMLeave +{ + +} + +message CMRevive +{ +} + +message CMCancelRevive +{ +} + +message CMAdStart +{ +} + +message CMAdCancel +{ +} + +message CMAdEnd +{ + optional int32 param = 1; +} + +message CMGetBoxInfo +{ + optional int32 box_id = 1; +} + +message CMOpenBox +{ + optional int32 box_id = 1; +} + +message CMMatchCancel +{ +} + +message CMMatchChoose +{ + optional int32 hero_id = 1; + repeated MFWeapon weapons = 2; + repeated MFSkin skins = 3; + repeated MFPair skill_list = 4; + repeated int32 baseskin = 5; + optional int32 hero_skin = 6; + optional string hero_uniid = 7; +} + +message CMMatchStartGame +{ +} + +message CMMatchCancelStartGame +{ +} + +message CMMatchSendMsg +{ + + repeated string target_list = 1; + optional string content = 2; +} + +message CMMatchBroadcastMsg +{ + + optional int32 exclude_self = 1; + optional string content = 2; +} + + +message SMWatchWar +{ + optional int32 error_code = 1 [default = 0]; + optional string error_msg = 2; + optional string name = 3; +} + +message SMJoinedNotify +{ + optional int32 team_mode = 1; + optional int32 player_id = 2; + optional bool started = 3; + optional string room_uuid = 4; + + optional int32 map_type = 5; + optional bool elo_start = 6; + + optional int32 error_code = 7; + optional int32 error_msg = 10; + optional int32 room_mode = 8; + + optional string server_info = 9; +} + +message SMMapInfo +{ + optional int32 map_id = 1; + optional float map_width = 2; + optional float map_height = 3; + repeated MFMapObject objects = 6; + optional int32 player_id = 7; + optional bool started = 8; + optional string room_uuid = 9; + optional string server_info = 10; +} + +message SMPlayerInfo +{ + optional MFPlayerInfo info = 1; +} + +message SMUpdate +{ + repeated int32 out_objids = 1; + repeated int32 del_objids = 2; + repeated MFObjectFull full_objects = 3; + repeated MFObjectPart part_objects = 4; + optional int32 active_player_id = 5; + optional MFActivePlayerData active_player_data = 6; + optional int32 alive_count = 15; + optional int32 gas_progress = 16; + optional MFVec2 gas_pos_old = 30; + optional MFGasData gas_data = 17; + repeated MFTeamData team_data = 18; + repeated MFBullet bullets = 20; + repeated MFShot shots = 21; + repeated MFExplosion explosions = 22; + repeated MFSmoke smokes = 25; + repeated MFEmote emotes = 23; + optional MFAirDrop airdrop = 26; + optional MFPlane plane = 27; + repeated MFBuffChg chged_buff_list = 28; + repeated MFPropertyChg chged_property_list = 31; + repeated MFPlaySkill play_skill_list = 32; + optional MFAirRaid airraid = 33; + + repeated MFTuple dead_alive_objs = 42; + + repeated MFPosition object_positions = 43; + optional int32 game_left_time = 45; + optional int32 frameno = 46; + repeated int32 del_bullets = 47; +} + +message SMRollMsg +{ + repeated MFRichTextElement elements = 1; +} + +message SMPlayerStats +{ + optional MFPlayerStats player_stats = 1; +} + +message SMGameOver +{ + optional int32 team_id = 1; + optional int32 team_rank = 2; + optional int32 team_allcnt = 3; + optional bool game_over = 4; + optional bool victory = 5; + optional int32 total_human_num = 12; + optional int32 alive_human_num = 13; + optional int32 watchable = 8; + + repeated MFPlayerStats player_stats = 6; + optional string room_uuid = 7; + repeated MFTeamData team_data = 10; + repeated MFTuple spoils_items = 11; + + optional MFOverReward reward = 14; +} + +message SMLeave +{ +} + +message SMGetBoxInfo +{ + optional int32 box_id = 1; + repeated MFTuple items = 2; +} + +message SMOpenBox +{ + optional int32 box_id = 1; + optional int32 errcode = 2; + optional string errmsg = 3; + repeated MFTuple items = 4; +} + +message SMDisconnectNotify +{ + optional string reason = 1; +} + +message SMVoiceNotify +{ + optional string account_id = 2; + optional string download_url = 3; +} + +message SMDebugMsg +{ + optional string debug_msg = 3; +} + +message SMWxVoip +{ + optional string group_id = 1; +} + +message SMUiUpdate +{ + optional int32 alive_count = 1; + optional int32 kill_count = 2; + repeated MFMapCarInfo car_list = 3; + + + optional int32 zombie_num = 10; + optional int32 human_num = 11; +} + +message SMGameStart +{ +} + +message SMSysPiaoMsg +{ + optional string msg = 1; + optional int32 color = 2; + optional int32 duration = 3; +} + +message SMShowCountdown +{ + optional string msg = 1; + optional int32 countdown = 2; + optional int32 msg_type = 3; +} + +message SMShowTeamUI +{ +} + +message SMUpdateMatchInfo +{ + optional MFMatchInfo info = 1; +} + +message SMMatchMemberMsgNotify +{ + optional string sender = 1; + optional string content = 2; +} + +message SMGetItemNotify +{ + repeated MFPair items = 8; +} \ No newline at end of file diff --git a/server/tools/robot/kcpclient/proto/out/metatable.proto b/server/tools/robot/kcpclient/proto/out/metatable.proto new file mode 100644 index 00000000..72fef39f --- /dev/null +++ b/server/tools/robot/kcpclient/proto/out/metatable.proto @@ -0,0 +1,556 @@ +package metatable; + +message MFPair +{ + optional int32 key = 1; + optional int32 value = 2; +} + +message Parameter +{ + optional string param_name = 1; + optional string param_value = 2; +} + +message Attr +{ + required int32 attr_id = 1; + required string attr_cname = 2; + required string attr_ename = 3; +} + +message Map +{ + optional int32 map_id = 1; + optional string template_list = 2; + optional string map_name = 3; + optional float map_width = 4; + optional float map_height = 5; + optional string airdrops = 6; + optional int32 terminator_airdrop = 7; + optional int32 player = 8; + optional string refresh_robot = 9; + optional int32 map_mode = 10; + optional string safearea = 11; + optional string game_start_buff_list = 12; + optional string map_pic = 13; + optional string first_safearea_center = 14; + optional int32 init_gas_ring = 15; + optional string airraids = 16; + optional string car_num_limit = 17; +} + +message MapThing +{ + optional int32 thing_id = 1; + optional int32 thing_type = 16; + optional int32 time = 17; + optional int32 type = 2; + optional int32 height = 3; + optional int32 width = 4; + optional int32 hp = 5; + optional float damage = 6; + optional float damage_dia = 7; + optional string drop = 8; + optional int32 is_door = 10; + optional int32 is_house = 11; + optional int32 is_tree = 12; + optional int32 house_id = 13; + optional string buff_list = 14; + optional int32 explosion_effect = 15; + optional int32 explosion_interval = 18; + optional int32 explosion_times = 19; + optional int32 explosion_float = 20; + optional string preexplosion_summon = 35; + optional string monster_list = 21; + optional string special_damage_type = 22; + optional string receive_special_damage_type = 23; + optional string param1 = 24; + optional string param2 = 25; + optional int32 interaction_mode = 26; + optional int32 view_mode = 27; + optional int32 bullet_hit = 28; + optional int32 collision_hit = 29; + optional int32 explosion_hit = 30; + optional string sweep_tags = 31; + optional int32 prebattle_hide = 32; + optional int32 life_time = 33; + optional int32 summon_born_rad = 34; +} + +message SafeArea +{ + optional int32 id = 1; + optional int32 level = 2; + optional int32 rad = 3; + optional int32 wait_time = 4; + optional int32 shrink_speed = 5; + optional int32 hurt = 6; + optional int32 type = 7; + optional int32 x1 = 8; + optional int32 y1 = 9; +} + +message SafeAreaPos +{ + optional int32 id = 1; + optional int32 x1 = 2; + optional int32 y1 = 3; + optional int32 x2 = 4; + optional int32 y2 = 5; + optional int32 x3 = 6; + optional int32 y3 = 7; + optional int32 x4 = 8; + optional int32 y4 = 9; + optional int32 x5 = 10; + optional int32 y5 = 11; + optional int32 x6 = 12; + optional int32 y6 = 13; + optional int32 x7 = 14; + optional int32 y7 = 15; + optional int32 x8 = 16; + optional int32 y8 = 17; + optional int32 x9 = 18; + optional int32 y9 = 19; + optional int32 x10 = 20; + optional int32 y10 = 21; +} + +message Item +{ + optional int32 id = 1; + optional int32 type = 2; + optional int32 sub_type = 3; + optional int32 quality = 4; + optional int32 use = 5; + optional int32 skinid = 6; + optional int32 isdefaultskin = 7; + optional int32 playerid = 8; + optional int32 relationship = 9; + optional string name = 10; +} + +message Equip +{ + optional int32 id = 1; + optional int32 equip_type = 2; + optional int32 equip_subtype = 3; + optional int32 equip_lv = 4; + optional int32 fire_mode = 5; + optional int32 use_bullet = 6; + optional int32 clip_volume = 7; + optional int32 reload_time = 8; + optional int32 fire_rate = 9; + optional int32 atk = 10; + optional int32 def = 11; + optional int32 max_hp = 41; + optional int32 explosion_range = 12; + optional int32 bullet_speed = 13; + optional int32 range = 14; + optional int32 use_time = 15; + optional int32 heal = 16; + optional int32 time = 17; + optional string volume = 19; + optional int32 bullet_rad = 20; + optional int32 group_num = 21; + optional int32 is_luck = 22; + optional string bullet_born_offset = 30; + optional float bullet_angle = 34; + optional string name = 35; + optional float rad = 36; + optional float rad2 = 37; + optional int32 buffid = 38; + optional int32 drop_id = 40; + optional int32 explosion_effect = 42; + optional string param1 = 43; + optional string param2 = 44; + optional int32 reloadtype = 46; + optional float recoil_force = 47; + optional int32 missiles_time = 48; + optional int32 heroid = 49; + optional string launch_dev = 50; + optional string power_time = 51; + optional string power_gun = 52; + optional string power_buff = 53; + optional int32 through_teammate = 54; + optional string text_icon = 55; + optional string special_damage_type = 56; + optional float max_oil = 57; + optional float average_oil = 58; + optional float atk_mech = 59; + optional int32 use_scene = 60; + optional int32 ispenetrate = 61; + optional int32 is_penetrate_thing = 62; + optional int32 reload_delay_time = 63; + optional int32 cast_time = 64; + optional int32 auto_switch_weapon_time = 65; + optional int32 quality = 66; + optional int32 explosion_damage_delay = 67; + optional int32 bullet_consume_type = 68; + + optional string inventory_slot = 31; + optional int32 _inventory_slot = 32; +} + +message EquipUpgrade +{ + optional int32 id = 1; + optional string attr_type = 4; + optional string spera_attr = 5; +} + +message Player +{ + optional int32 id = 1; + optional float move_offset_x = 40; + optional float move_offset_y = 41; + optional float radius = 2; + optional int32 health = 3; + optional int32 move_speed = 4; + optional int32 jump_speed = 5; + optional int32 move_speed3 = 6; + optional int32 shot_speed = 7; + optional int32 aiming_speed = 8; + optional int32 move_speed4 = 10; + optional int32 reload_speed = 9; + optional int32 useitem_speed = 49; + optional float def = 11; + optional string volume = 12; + optional int32 level = 13; + optional int32 race = 14; + optional int32 active_skill = 15; + optional int32 passive_skill = 16; + optional int32 exp = 17; + optional int32 dead_exp = 18; + optional int32 killer_exp = 19; + optional int32 revive_time = 22; + optional string name = 23; + optional int32 normal_skill = 24; + optional float hit_offset_x = 42; + optional float hit_offset_y = 43; + optional float hit_radius = 25; + optional string ai_script = 26; + optional string init_buffs = 27; + optional int32 default_weapon = 28; + optional string dead_drop = 29; + optional int32 delay_delete = 39; + optional int32 ai = 46; + optional int32 delay_remove = 47; + optional int32 skinlist = 48; + optional string pre_appear_effect = 50; + + optional int32 damage = 51; + optional int32 defence = 52; +} + +message Robot +{ + optional int32 id = 1; + optional string name = 2; + optional int32 hero_id = 3; + optional string skin_id = 10; + optional int32 weapon_id = 4; + optional int32 weapon_lv = 5; + + optional int32 sex = 8; +} + +message Skill +{ + required int32 skill_id = 1; + required int32 skill_type = 2; + required string value_up = 6; + required int32 skill_cd = 7; + required int32 skill_target = 8; + required string buff_list = 9; + required float skill_distance = 10; + required int32 cold_time_up = 11; + required int32 max_times = 12; + + optional int32 phase1_time_offset = 20; + optional int32 phase1_func = 21; + optional string phase1_param1 = 22; + optional string phase1_param2 = 23; + optional string phase1_param3 = 24; + + optional int32 phase2_time_offset = 30; + optional int32 phase2_func = 31; + optional string phase2_param1 = 32; + optional string phase2_param2 = 33; + optional string phase2_param3 = 34; + + optional int32 phase3_time_offset = 40; + optional int32 phase3_func = 41; + optional string phase3_param1 = 42; + optional string phase3_param2 = 43; + optional string phase3_param3 = 44; + optional int32 cast_time = 45; + + optional int32 up_exp = 50; + optional int32 nextlv_skill = 51; +} + +message Buff +{ + required int32 buff_id = 1; + required string name = 20; + required int32 buff_target = 2; + required int32 buff_effect = 3; + required int32 trigger_type = 4; + required string buff_param1 = 6; + required string buff_param2 = 7; + required string buff_param3 = 8; + required string buff_param4 = 9; + optional string buff_param5 = 19; + required float duration_time = 10; + optional float buff_valueup = 11; + required string immune_buffeffect_list = 12; + optional string post_remove_action = 13; + optional int32 only_server = 14; + optional int32 only_self = 15; + optional int32 depend_effect = 16; + optional string child_buff = 17; + optional int32 coexist_num = 18; + optional int32 dead_valid = 23; + optional int32 buff_interval = 24; + optional string tag = 25; + optional int32 post_battle_valid = 26; + optional string only_spec_race = 27; + optional string exclude_spec_race = 28; + optional int32 dead_remove = 29; + optional int32 no_immune = 30; +} + +message Drop +{ + optional int32 drop_id = 1; + optional string item_id = 2; + optional string num = 3; + optional string weight = 4; + optional int32 type = 5; +} + +message AirDrop +{ + optional int32 id = 1; + optional int32 time = 2; + optional int32 appear_time = 3; + optional string drop_id = 4; +} + +message AirRaid +{ + optional int32 id = 1; + optional int32 time = 2; + optional int32 appear_time = 3; + optional string bomb_id = 4; + optional string raid_wave = 5; + optional float rad = 6; +} + +message AirLine +{ + optional int32 id = 1; + optional string start_point = 2; + optional string end_point = 3; + optional float plane_speed = 4; + optional int32 weight = 5; + optional int32 map_id = 6; +} + +message Dress +{ + optional int32 id = 1; + optional int32 level = 2; + optional int32 skill_id = 3; + optional string attr_type = 4; + optional int32 max_lv = 5; +} + +message RankReward +{ + optional int32 rank = 1; + optional float parameter = 2; + optional int32 drop = 3; +} + +message RankPoint +{ + optional int32 rank = 1; + optional int32 parameter = 2; + optional int32 parameter2 = 3; + optional int32 parameter3 = 4; +} + +message KillReward +{ + optional int32 kill_num = 1; + optional float parameter = 2; +} + +message KillPoint +{ + optional int32 kill_num = 1; + optional int32 parameter = 2; + optional int32 parameter2 = 3; +} + +message AI +{ + optional int32 id = 13; + + optional int32 pursuit_radius = 2; + optional int32 attack_interval = 3; + optional int32 attack_times = 4; + optional int32 attack_type = 5; + optional int32 shot_offset_angle = 6; + optional string random_move_idle_time = 8; + optional string random_move_time = 9; + optional int32 attack_range = 10; + optional float attack_rate = 11; + optional int32 ai_mode = 12; + optional int32 ai_kind = 14; + optional string param1 = 15; + optional string param2 = 16; + optional string param3 = 17; + optional string param4 = 18; + optional string param5 = 19; + optional int32 peace_time = 20; +} + +message Text +{ + optional string textid = 1; + optional string text = 2; +} + +message GunTalentGrow +{ + optional int32 id = 1; + optional int32 talent_id = 2; + optional int32 talent_lv = 3; + optional int32 addtype = 4; + optional string addattr = 5; +} + +message HeroQuality +{ + optional int32 id = 1; + optional int32 quality = 2; + optional int32 gold_limit = 3; + optional int32 lucky = 4; +} + +message GunQuality +{ + optional int32 id = 1; + optional int32 quality = 2; + optional int32 gold_limit = 3; + optional int32 lucky = 4; +} + +message FormulaPvp +{ + optional float top = 1; + optional float ranked_topx = 2; + optional float kills_topx = 3; + optional float hero_topx = 4; + optional float weapon_topx = 5; + optional float survival_topx = 6; +} + + +message DoorObjJson +{ + optional float height = 1; + optional float width = 2; + optional float x = 3; + optional float y = 4; + optional int32 type = 5; + optional int32 id = 6; +} + +message DropObjJson +{ + optional float x = 1; + optional float y = 2; + optional int32 id = 3; +} + +message StaticObjJson +{ + optional float x = 1; + optional float y = 2; + optional float height = 3; + optional float width = 4; +} + +message LootObjJson +{ + optional float x = 1; + optional float y = 2; + optional int32 weight = 3; + optional string things = 4; + repeated MFPair _things = 5; + optional int32 _rand_space = 6; +} + +message BuildingJson +{ + + optional float tileheight = 2; + optional float tilewidth = 3; + repeated DoorObjJson doorObj = 4; + repeated DropObjJson dropObj = 5; + repeated StaticObjJson staticObj = 6; + repeated LootObjJson lootObj = 7; + repeated StaticObjJson halfwallObj = 8; + + optional int32 mapId = 20; +} + +message MapTplThingJson +{ + optional string layer_name = 1; + optional string name = 2; + optional string things = 3; + optional int32 weight = 4; + optional float x = 5; + optional float y = 6; + optional float height = 7; + optional float width = 8; + optional string param1 = 9; + optional float param2 = 10; + optional float param3 = 11; + optional string object_type = 12; + optional int32 _object_type = 13; +} + +message TerrainJson +{ + optional int32 map_id = 1; + repeated int32 dust = 2; + repeated int32 water = 3; + repeated int32 grass = 4; + repeated int32 mountain_top = 5; +} + +message MapLayerJson +{ + optional string name = 1; + optional int32 width = 2; + optional int32 height = 3; + repeated int32 grids = 4; +} + +message MapBlockJson +{ + optional int32 shape = 1; + optional float x = 5; + optional float y = 6; + optional float height = 7; + optional float width = 8; + optional float rad = 9; + optional int32 bullet_penetrate = 10; + optional int32 collider_tag = 11; +} diff --git a/server/tools/robot/kcpclient/proto/out/ss_msgid.proto b/server/tools/robot/kcpclient/proto/out/ss_msgid.proto new file mode 100644 index 00000000..d8334a8d --- /dev/null +++ b/server/tools/robot/kcpclient/proto/out/ss_msgid.proto @@ -0,0 +1,13 @@ +package ss; + +enum SSMessageId_e +{ + _SS_Ping = 8; + _SS_Pong = 9; + + _SS_WSP_SocketDisconnect = 10; + _SS_WSP_RequestTargetServer = 11; + _SS_MS_ResponseTargetServer = 12; + _SS_ForceCloseSocket = 13; + +} diff --git a/server/tools/robot/kcpclient/proto/out/ss_proto.proto b/server/tools/robot/kcpclient/proto/out/ss_proto.proto new file mode 100644 index 00000000..be049059 --- /dev/null +++ b/server/tools/robot/kcpclient/proto/out/ss_proto.proto @@ -0,0 +1,35 @@ +package ss; + +message SS_Ping +{ + +} + +message SS_Pong +{ + +} + +message SS_WSP_SocketDisconnect +{ +} + +message SS_WSP_RequestTargetServer +{ + optional int64 context_id = 1; + optional string account_id = 2; + optional string team_id = 3; +} + +message SS_MS_ResponseTargetServer +{ + optional int32 error_code = 1; + optional string error_msg = 2; + optional int64 context_id = 3; + optional string host = 4; + optional int32 port = 5; +} + +message SS_ForceCloseSocket +{ +} diff --git a/server/tools/robot/kcpclient/proto/ss_msgid.proto b/server/tools/robot/kcpclient/proto/ss_msgid.proto new file mode 100644 index 00000000..0595eb52 --- /dev/null +++ b/server/tools/robot/kcpclient/proto/ss_msgid.proto @@ -0,0 +1,14 @@ +package ss; + +//消息id定义 +enum SSMessageId_e +{ + _SS_Ping = 8; + _SS_Pong = 9; + + _SS_WSP_SocketDisconnect = 10; + _SS_WSP_RequestTargetServer = 11; + _SS_MS_ResponseTargetServer = 12; + _SS_ForceCloseSocket = 13; + +} diff --git a/server/tools/robot/kcpclient/proto/ss_proto.proto b/server/tools/robot/kcpclient/proto/ss_proto.proto new file mode 100755 index 00000000..be049059 --- /dev/null +++ b/server/tools/robot/kcpclient/proto/ss_proto.proto @@ -0,0 +1,35 @@ +package ss; + +message SS_Ping +{ + +} + +message SS_Pong +{ + +} + +message SS_WSP_SocketDisconnect +{ +} + +message SS_WSP_RequestTargetServer +{ + optional int64 context_id = 1; + optional string account_id = 2; + optional string team_id = 3; +} + +message SS_MS_ResponseTargetServer +{ + optional int32 error_code = 1; + optional string error_msg = 2; + optional int64 context_id = 3; + optional string host = 4; + optional int32 port = 5; +} + +message SS_ForceCloseSocket +{ +} diff --git a/server/tools/robot/kcpclient/testcase.js b/server/tools/robot/kcpclient/testcase.js new file mode 100644 index 00000000..58f926dc --- /dev/null +++ b/server/tools/robot/kcpclient/testcase.js @@ -0,0 +1,91 @@ +const axios = require('axios').default; +const ClientNet = require('./clientnet'); + +function getTickCount() { + return Math.floor((new Date()).getTime() / 1); +} + +function httpGet(url, params) { + return new Promise((resolve) => { + const ret = { + err: null, + response: null, + }; + axios({ + method: 'get', + url: url, + timeout: 1000 * 5, + params: params, + responseType: 'text' + }).then((response) => { + ret.response = response.data; + resolve(ret); + }).catch((error) => { + ret.err = error; + resolve(ret); + }); + }); +} + +async function sleep(timeout) { + return new Promise(function (resolve, reject) { + setTimeout(function () { + resolve(); + }, timeout); + }); +} + +class TestCase { + + constructor(url) { + this.relationUrl = 'ws://192.168.100.45:7602/websocket?server_id=6'; + //this.relationUrl = 'ws://8.133.161.108/game1006/websocket/'; + this.loginData = null; + this.gameConn = new ClientNet( + this.relationUrl, + 'proto/cs_proto.proto', + 'proto/cs_msgid.proto' + ); + } + + async init() { + await this.step1(); + await this.step2(); + while (true) { + await sleep(1000 * 3); + } + } + + async step1() { + const startTick = getTickCount(); + const {err, response} = await httpGet( + 'https://login-test.kingsome.cn/webapp/index.php', + { + 'c': 'Login', + 'a': 'auth', + 'channel': 6513, + 'login_type': 1001, + 'login_from': 1001, + 'gameid': 2006, + 'openid': 'e5vjg90hmboncfkqjDaiM8craNX23zPu' + }); + this.loginData = response; + const endTick = getTickCount(); + console.log('login auth@Login', endTick - startTick, String(err), response); + } + + async step2() { + await this.gameConn.init(); + await this.gameConn.connect(); + + this.gameConn.accountId = this.loginData['account_id']; + this.gameConn.sessionId = this.loginData['session_id']; + this.gameConn.sendMsg('CMJoin', { + account_id: this.loginData['account_id'], + session_id: this.loginData['session_id'], + }); + } + +} + +module.exports = TestCase;