From 81931aed4336a7f364c8688c25628b338cb35085 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 6 Sep 2022 19:20:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0pb=E5=B7=A5=E5=85=B7=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pb/proto.js | 548 ++++++++++++++++++++--------- src/pb/proto/battle_db.proto | 51 +++ src/pb/proto/battle_msg.proto | 25 ++ src/pb/proto/moonfantasy_db.proto | 2 +- src/pb/proto/moonfantasy_msg.proto | 38 +- 5 files changed, 490 insertions(+), 174 deletions(-) create mode 100644 src/pb/proto/battle_db.proto create mode 100644 src/pb/proto/battle_msg.proto diff --git a/src/pb/proto.js b/src/pb/proto.js index c66bf34..ed207fb 100644 --- a/src/pb/proto.js +++ b/src/pb/proto.js @@ -8,6 +8,321 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr go_package: ".;pb" }) .addJSON({ + BattleType: { + values: { + nil: 0, + pve: 1, + pvp: 2, + pvb: 3 + } + }, + PlayType: { + values: { + mainline: 0, + pagoda: 1, + moonfantasy: 2 + } + }, + BBattleState: { + values: { + "in": 0, + end: 2 + } + }, + DBBattleComp: { + values: { + draw: 0, + red: 1, + bule: 2 + } + }, + DBBattleFormt: { + fields: { + leadpos: { + type: "int32", + id: 1 + }, + team: { + rule: "repeated", + type: "DBHero", + id: 2 + } + } + }, + DBBattleRecord: { + fields: { + id: { + type: "string", + id: 1 + }, + btype: { + type: "BattleType", + id: 2 + }, + ptype: { + type: "PlayType", + id: 3 + }, + plevel: { + type: "string", + id: 4 + }, + state: { + type: "BBattleState", + id: 5 + }, + redCompId: { + type: "string", + id: 6 + }, + redflist: { + rule: "repeated", + type: "DBBattleFormt", + id: 7 + }, + blueCompId: { + type: "string", + id: 8 + }, + buleflist: { + rule: "repeated", + type: "DBBattleFormt", + id: 9 + }, + roundresult: { + rule: "repeated", + type: "DBBattleComp", + id: 10 + }, + result: { + type: "DBBattleComp", + id: 11 + } + } + }, + SkillData: { + fields: { + skillID: { + type: "int32", + id: 1 + }, + skillLv: { + type: "int32", + id: 2 + } + } + }, + DBHero: { + fields: { + id: { + type: "string", + id: 1 + }, + uid: { + type: "string", + id: 2 + }, + heroID: { + type: "string", + id: 3 + }, + star: { + type: "int32", + id: 4 + }, + lv: { + type: "int32", + id: 5 + }, + exp: { + type: "int32", + id: 6 + }, + juexingLv: { + type: "int32", + id: 7 + }, + captainSkill: { + type: "int32", + id: 8 + }, + normalSkill: { + rule: "repeated", + type: "SkillData", + id: 9 + }, + property: { + keyType: "string", + type: "int32", + id: 10 + }, + addProperty: { + keyType: "string", + type: "int32", + id: 11 + }, + cardType: { + type: "int32", + id: 12 + }, + curSkin: { + type: "int32", + id: 13 + }, + skins: { + rule: "repeated", + type: "int32", + id: 14 + }, + block: { + type: "bool", + id: 15 + }, + equipID: { + rule: "repeated", + type: "string", + id: 16 + }, + resonateNum: { + type: "int32", + id: 17 + }, + distributionResonate: { + type: "int32", + id: 18 + }, + energy: { + keyType: "string", + type: "int32", + id: 19 + }, + sameCount: { + type: "int32", + id: 20 + }, + suiteId: { + type: "int32", + id: 21 + }, + suiteExtId: { + type: "int32", + id: 22 + }, + isOverlying: { + type: "bool", + id: 23 + }, + energyProperty: { + keyType: "string", + type: "int32", + id: 24 + }, + juexProperty: { + keyType: "string", + type: "int32", + id: 25 + } + } + }, + Floor: { + fields: { + h4: { + type: "int32", + id: 1 + }, + h5: { + type: "int32", + id: 2 + } + } + }, + DBHeroRecord: { + fields: { + id: { + type: "string", + id: 1 + }, + uid: { + type: "string", + id: 2 + }, + star4: { + type: "int32", + id: 3 + }, + star5: { + type: "int32", + id: 4 + }, + mtime: { + type: "int64", + id: 5 + }, + drawcount: { + type: "int32", + id: 6 + } + } + }, + BattlePVEReq: { + fields: { + ptype: { + type: "PlayType", + id: 1 + }, + leadpos: { + type: "int32", + id: 2 + }, + teamids: { + rule: "repeated", + type: "string", + id: 3 + }, + mformat: { + rule: "repeated", + type: "int32", + id: 4 + } + } + }, + BattleInfo: { + fields: { + id: { + type: "string", + id: 1 + }, + btype: { + type: "BattleType", + id: 2 + }, + ptype: { + type: "PlayType", + id: 3 + }, + redCompId: { + type: "string", + id: 4 + }, + redflist: { + rule: "repeated", + type: "DBBattleFormt", + id: 5 + }, + blueCompId: { + type: "string", + id: 6 + }, + buleflist: { + rule: "repeated", + type: "DBBattleFormt", + id: 7 + } + } + }, + BattleReport: { + fields: {} + }, ChatChannel: { values: { World: 0, @@ -847,170 +1162,6 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, - SkillData: { - fields: { - skillID: { - type: "int32", - id: 1 - }, - skillLv: { - type: "int32", - id: 2 - } - } - }, - DBHero: { - fields: { - id: { - type: "string", - id: 1 - }, - uid: { - type: "string", - id: 2 - }, - heroID: { - type: "string", - id: 3 - }, - star: { - type: "int32", - id: 4 - }, - lv: { - type: "int32", - id: 5 - }, - exp: { - type: "int32", - id: 6 - }, - juexingLv: { - type: "int32", - id: 7 - }, - captainSkill: { - type: "int32", - id: 8 - }, - normalSkill: { - rule: "repeated", - type: "SkillData", - id: 9 - }, - property: { - keyType: "string", - type: "int32", - id: 10 - }, - addProperty: { - keyType: "string", - type: "int32", - id: 11 - }, - cardType: { - type: "int32", - id: 12 - }, - curSkin: { - type: "int32", - id: 13 - }, - skins: { - rule: "repeated", - type: "int32", - id: 14 - }, - block: { - type: "bool", - id: 15 - }, - equipID: { - rule: "repeated", - type: "string", - id: 16 - }, - resonateNum: { - type: "int32", - id: 17 - }, - distributionResonate: { - type: "int32", - id: 18 - }, - energy: { - keyType: "string", - type: "int32", - id: 19 - }, - sameCount: { - type: "int32", - id: 20 - }, - suiteId: { - type: "int32", - id: 21 - }, - suiteExtId: { - type: "int32", - id: 22 - }, - isOverlying: { - type: "bool", - id: 23 - }, - energyProperty: { - keyType: "string", - type: "int32", - id: 24 - }, - juexProperty: { - keyType: "string", - type: "int32", - id: 25 - } - } - }, - Floor: { - fields: { - h4: { - type: "int32", - id: 1 - }, - h5: { - type: "int32", - id: 2 - } - } - }, - DBHeroRecord: { - fields: { - id: { - type: "string", - id: 1 - }, - uid: { - type: "string", - id: 2 - }, - star4: { - type: "int32", - id: 3 - }, - star5: { - type: "int32", - id: 4 - }, - mtime: { - type: "int64", - id: 5 - }, - drawcount: { - type: "int32", - id: 6 - } - } - }, DBFriend: { fields: { uid: { @@ -2452,7 +2603,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr id: 2 }, monster: { - type: "int32", + type: "string", id: 3 }, ctime: { @@ -2505,12 +2656,12 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr id: 2 }, monster: { - type: "int32", + type: "string", id: 3 } } }, - MoonfantasyDareReq: { + MoonfantasyAskReq: { fields: { uid: { type: "string", @@ -2522,7 +2673,68 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, - MoonfantasyDareResp: { + MoonfantasyAskResp: { + fields: { + code: { + type: "ErrorCode", + id: 1 + } + } + }, + MoonfantasyBattleReq: { + fields: { + uid: { + type: "string", + id: 1 + }, + mid: { + type: "string", + id: 2 + }, + leadpos: { + type: "int32", + id: 3 + }, + teamids: { + rule: "repeated", + type: "string", + id: 4 + } + } + }, + MoonfantasyBattleResp: { + fields: { + code: { + type: "ErrorCode", + id: 1 + }, + monster: { + type: "string", + id: 2 + }, + info: { + type: "BattleInfo", + id: 3 + } + } + }, + MoonfantasyReceiveReq: { + fields: { + bid: { + type: "string", + id: 2 + }, + monster: { + type: "string", + id: 3 + }, + report: { + type: "BattleReport", + id: 4 + } + } + }, + MoonfantasyReceiveResp: { fields: { issucc: { type: "bool", diff --git a/src/pb/proto/battle_db.proto b/src/pb/proto/battle_db.proto new file mode 100644 index 0000000..ee450b5 --- /dev/null +++ b/src/pb/proto/battle_db.proto @@ -0,0 +1,51 @@ +syntax = "proto3"; +option go_package = ".;pb"; +import "hero_db.proto"; + +enum BattleType { + nil = 0; + pve = 1; + pvp = 2; + pvb = 3; +} + +//玩法类型 +enum PlayType { + mainline = 0; //主线玩法 + pagoda = 1; //爬塔 + moonfantasy = 2; //月之秘境 +} + +//战斗状态 +enum BBattleState { + in = 0; + end = 2; +} + +//战斗阵型信息 +enum DBBattleComp { + draw = 0; //平局 + red = 1; //红方 + bule = 2; //蓝方 +} + +//战斗阵型信息 +message DBBattleFormt { + int32 leadpos = 1; //队长位置 + repeated DBHero team = 2; +} + +//战斗记录 +message DBBattleRecord { + string id = 1; //战斗记录id + BattleType btype = 2; //战斗类型 + PlayType ptype = 3; //玩法类型 + string plevel = 4; //玩法关卡 + BBattleState state = 5; //战斗状态 + string redCompId = 6; //红方阵营id + repeated DBBattleFormt redflist = 7; //红方阵型列表 + string blueCompId = 8; //蓝方阵营id + repeated DBBattleFormt buleflist = 9; //红方阵型列表 + repeated DBBattleComp roundresult = 10; //战斗场次结果 + DBBattleComp result = 11; //最终结果 +} \ No newline at end of file diff --git a/src/pb/proto/battle_msg.proto b/src/pb/proto/battle_msg.proto new file mode 100644 index 0000000..2aeb29b --- /dev/null +++ b/src/pb/proto/battle_msg.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +option go_package = ".;pb"; +import "battle_db.proto"; + +// pve 战斗创建请求 (此请求 为服务端间使用 客户端可忽略) +message BattlePVEReq { + PlayType ptype = 1; //玩法类型 + int32 leadpos = 2; //队长位置 + repeated string teamids = 3; //阵容信息 + repeated int32 mformat = 4; //敌方增容信息 +} + +//战斗开始推送 +message BattleInfo { + string id = 1; //战斗id + BattleType btype = 2; //战斗类型 + PlayType ptype = 3; //玩法类型 + string redCompId = 4; //红方阵营id + repeated DBBattleFormt redflist = 5; //红方阵型列表 + string blueCompId = 6; //蓝方阵营id + repeated DBBattleFormt buleflist = 7; //红方阵型列表 +} + +//战报数据 +message BattleReport {} diff --git a/src/pb/proto/moonfantasy_db.proto b/src/pb/proto/moonfantasy_db.proto index 32aeeb5..d03fcd9 100644 --- a/src/pb/proto/moonfantasy_db.proto +++ b/src/pb/proto/moonfantasy_db.proto @@ -4,7 +4,7 @@ option go_package = ".;pb"; message DBMoonfantasy { string id = 1; //@go_tags(`bson:"_id"`) ID string uid = 2; //用户id - int32 monster = 3; //怪物id + string monster = 3; //英雄id int64 ctime = 4; //创建时间 int32 joinnum = 5; //参与人数 int32 numup = 6; //人数上限 diff --git a/src/pb/proto/moonfantasy_msg.proto b/src/pb/proto/moonfantasy_msg.proto index 661a54f..06a10e2 100644 --- a/src/pb/proto/moonfantasy_msg.proto +++ b/src/pb/proto/moonfantasy_msg.proto @@ -1,5 +1,7 @@ syntax = "proto3"; option go_package = ".;pb"; +import "errorcode.proto"; +import "battle_msg.proto"; ///触发秘境 message MoonfantasyTriggerReq { @@ -10,17 +12,43 @@ message MoonfantasyTriggerReq { ///触发秘境 message MoonfantasyTriggerResp { - bool issucc = 1; //是否成功 - string mid = 2; //唯一id //挑战时需要传递的数据 - int32 monster = 3; //怪物id + bool issucc = 1; //是否成功 + string mid = 2; //唯一id //挑战时需要传递的数据 + string monster = 3; //怪物id } ///挑战秘境 -message MoonfantasyDareReq { +message MoonfantasyAskReq { string uid = 1; //发布者用户id string mid = 2; //唯一id } -message MoonfantasyDareResp { +message MoonfantasyAskResp { + ErrorCode code = 1; //是否成功 +} + +///挑战秘境 +message MoonfantasyBattleReq { + string uid = 1; //发布者用户id + string mid = 2; //唯一id + int32 leadpos = 3; //队长位置 + repeated string teamids = 4; //阵容信息 +} + +message MoonfantasyBattleResp { + ErrorCode code = 1; //是否成功 + string monster = 2; //怪物id + BattleInfo info = 3; +} + +///领取战斗奖励 +message MoonfantasyReceiveReq { + string bid = 2; //战斗id 后续需要这个id来领取奖励 + string monster = 3; //怪物id + BattleReport report = 4; //战报 +} + +///领取战斗奖励 +message MoonfantasyReceiveResp { bool issucc = 1; //是否成功 } \ No newline at end of file