上传战斗远程校验

This commit is contained in:
liwei1dao 2022-12-12 17:40:55 +08:00
parent b50c0bfee2
commit 6eb1de7b26
6 changed files with 259 additions and 105 deletions

View File

@ -2,11 +2,12 @@ package battle
import (
"context"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"sync"
"sync/atomic"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/core/cbase"
"go_dreamfactory/lego/sys/log"
"github.com/gorilla/websocket"
@ -18,50 +19,83 @@ import (
战斗服务客户端组件
*/
type clientComp struct {
modules.MCompGate
cbase.ModuleCompBase
options *Options
service core.IService
module *Battle
mutexs []sync.Mutex
clinets []*client
i int
}
//组件初始化接口
func (this *clientComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.MCompGate.Init(service, module, comp, options)
this.ModuleCompBase.Init(service, module, comp, options)
this.options = options.(*Options)
this.module = module.(*Battle)
this.mutexs = make([]sync.Mutex, len(this.options.BattleServerAddr))
this.clinets = make([]*client, len(this.options.BattleServerAddr))
return
}
func (this *clientComp) Start() (err error) {
err = this.MCompGate.Start()
err = this.ModuleCompBase.Start()
for i, v := range this.options.BattleServerAddr {
if this.clinets[i], err = newClient(v, this.options.Log); err != nil {
if this.clinets[i], err = newClient(v, i, this, this.options.Log); err != nil {
return
}
}
return
}
func (this *clientComp) callBattle(ctx context.Context, method string, req proto.Message, reply proto.Message) (err error) {
i := this.i % len(this.clinets)
this.i += 1
err = this.clinets[i].callBattle(ctx, method, req, reply)
//关闭客户端连接对象
func (this *clientComp) Shutdown(c *client) {
this.mutexs[c.index].Lock()
defer this.mutexs[c.index].Unlock()
this.clinets[c.index] = nil
this.module.Errorf("战斗校验服务%d 被关闭! ", c.index)
}
func (this *clientComp) CheckBattle(ctx context.Context, req proto.Message) (reply *pb.BattleCheckResults, err error) {
var (
c *client
)
reply = &pb.BattleCheckResults{}
if c, err = this.selector(); err != nil {
return
}
err = c.callBattle(ctx, "Check", req, reply)
return
}
func newClient(addr string, log log.ILogger) (c *client, err error) {
c = &client{log: log, pending: make(map[uint64]*MessageCall)}
//选择连接服务器
func (this *clientComp) selector() (c *client, err error) {
i := this.i % len(this.clinets)
this.i += 1
if this.clinets[i] != nil {
c = this.clinets[i]
return
} else {
if this.clinets[i], err = newClient(this.options.BattleServerAddr[i], i, this, this.options.Log); err != nil {
this.module.Errorln(err)
}
}
return
}
func newClient(addr string, i int, mgr IClientMgr, log log.ILogger) (c *client, err error) {
c = &client{mgr: mgr, log: log, index: i, state: 1, pending: make(map[uint64]*MessageCall)}
dialer := websocket.Dialer{}
c.conn, _, err = dialer.Dial(addr, nil)
return
}
type client struct {
mgr IClientMgr
log log.ILogger
index int
conn *websocket.Conn
state int32 //状态 0 关闭 1 运行 2 关闭中
seq uint64
pendingmutex sync.Mutex
pending map[uint64]*MessageCall //高并发回调
@ -117,11 +151,12 @@ locp:
for {
if _, data, err = this.conn.ReadMessage(); err != nil {
this.log.Errorf("client err:%v", err)
this.Close()
break locp
}
if err = proto.Unmarshal(data, msg); err != nil {
this.log.Errorf("client Unmarshal err:%v", err)
break locp
continue
}
go this.handleresponse(msg)
}
@ -136,3 +171,13 @@ func (this *client) handleresponse(resp *pb.BattleRpcMessage) {
call.Error = resp.Data.UnmarshalTo(call.Reply)
call.done(this.log)
}
//外部代用关闭
func (this *client) Close() {
if !atomic.CompareAndSwapInt32(&this.state, 1, 2) {
return
}
this.conn.Close()
atomic.StoreInt32(&this.state, 0)
this.mgr.Shutdown(this)
}

7
modules/battle/core.go Normal file
View File

@ -0,0 +1,7 @@
package battle
type (
IClientMgr interface {
Shutdown(c *client)
}
)

View File

@ -1,12 +1,15 @@
package battle
import (
"context"
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go_dreamfactory/sys/db"
"time"
)
/*
@ -22,11 +25,13 @@ func NewModule() core.IModule {
type Battle struct {
modules.ModuleBase
service base.IRPCXService
options *Options
friend comm.IFriend //好友系统
moonfantasy comm.IMoonFantasy //月之秘境模块
api_comp *apiComp
configure *configureComp
modelBattle *modelBattleComp
clients *clientComp
}
//模块名
@ -34,10 +39,15 @@ func (this *Battle) GetType() core.M_Modules {
return comm.ModuleBattle
}
func (this *Battle) NewOptions() (options core.IModuleOptions) {
return new(Options)
}
//模块初始化接口 注册用户创建角色事件
func (this *Battle) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
this.service = service.(base.IRPCXService)
this.options = options.(*Options)
return
}
func (this *Battle) Start() (err error) {
@ -60,6 +70,7 @@ func (this *Battle) OnInstallComp() {
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
this.modelBattle = this.RegisterComp(new(modelBattleComp)).(*modelBattleComp)
this.clients = this.RegisterComp(new(clientComp)).(*clientComp)
}
//查询战斗记录
@ -181,6 +192,19 @@ func (this *Battle) CreatePvpBattle(session comm.IUserSession, req *pb.BattlePVP
//校验战报是否成功
func (this *Battle) CheckBattleReport(session comm.IUserSession, report *pb.BattleReport) (code pb.ErrorCode, iswin bool) {
var (
reply *pb.BattleCheckResults
err error
)
if this.options.OpenCheck {
stime := time.Now()
if reply, err = this.clients.CheckBattle(context.Background(), report); err != nil || !reply.Ischeck {
code = pb.ErrorCode_BattleValidationFailed
this.Error("[Battle Check]", log.Fields{"t": time.Since(stime).Milliseconds(), "reply": reply.String()})
return
}
this.Debug("[Battle Check]", log.Fields{"t": time.Since(stime).Milliseconds(), "reply": reply.String()})
}
this.moonfantasy.Trigger(session, report)
return pb.ErrorCode_Success, true
}

View File

@ -95,7 +95,7 @@ func testdefer(data *[]int) {
func Test_Comment(t *testing.T) {
dialer := websocket.Dialer{}
if connect, _, err := dialer.Dial("ws://127.0.0.1:9898", nil); err != nil {
if connect, _, err := dialer.Dial("ws://127.0.0.1:9897", nil); err != nil {
fmt.Println(err)
return
} else {
@ -122,9 +122,9 @@ func Test_Comment(t *testing.T) {
msg := &pb.BattleRpcMessage{
Rid: 1,
Method: "test",
Method: "Check",
}
msg.Data, _ = anypb.New(&pb.BattleTestMessage{})
msg.Data, _ = anypb.New(&pb.BattleReport{})
data, _ := proto.Marshal(msg)
connect.WriteMessage(websocket.BinaryMessage, data)
//监听外部关闭服务信号

View File

@ -13,6 +13,7 @@ type (
}
Options struct {
modules.Options
OpenCheck bool
BattleServerAddr []string
}
)

View File

@ -556,22 +556,78 @@ func (x *BattleInfo) GetTasks() []int32 {
return nil
}
type BattleCmd struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Cmdtype string `protobuf:"bytes,1,opt,name=cmdtype,proto3" json:"cmdtype"`
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value"`
}
func (x *BattleCmd) Reset() {
*x = BattleCmd{}
if protoimpl.UnsafeEnabled {
mi := &file_battle_battle_msg_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BattleCmd) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BattleCmd) ProtoMessage() {}
func (x *BattleCmd) ProtoReflect() protoreflect.Message {
mi := &file_battle_battle_msg_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use BattleCmd.ProtoReflect.Descriptor instead.
func (*BattleCmd) Descriptor() ([]byte, []int) {
return file_battle_battle_msg_proto_rawDescGZIP(), []int{7}
}
func (x *BattleCmd) GetCmdtype() string {
if x != nil {
return x.Cmdtype
}
return ""
}
func (x *BattleCmd) GetValue() []byte {
if x != nil {
return x.Value
}
return nil
}
//战报数据
type BattleReport struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Info *BattleInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info"`
Costtime int32 `protobuf:"varint,2,opt,name=Costtime,proto3" json:"Costtime"` //战斗时长 单位ms
Process []byte `protobuf:"bytes,3,opt,name=process,proto3" json:"process"` //战斗过程数据
Completetask []int32 `protobuf:"varint,4,rep,packed,name=completetask,proto3" json:"completetask"` //完成任务
Info *BattleInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info"`
Costtime int32 `protobuf:"varint,2,opt,name=Costtime,proto3" json:"Costtime"` //战斗时长 单位ms
Incmd []*BattleCmd `protobuf:"bytes,3,rep,name=incmd,proto3" json:"incmd"` //输入指令
Outcmd []*BattleCmd `protobuf:"bytes,4,rep,name=outcmd,proto3" json:"outcmd"` //输出指令
Completetask []int32 `protobuf:"varint,5,rep,packed,name=completetask,proto3" json:"completetask"` //完成任务
}
func (x *BattleReport) Reset() {
*x = BattleReport{}
if protoimpl.UnsafeEnabled {
mi := &file_battle_battle_msg_proto_msgTypes[7]
mi := &file_battle_battle_msg_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -584,7 +640,7 @@ func (x *BattleReport) String() string {
func (*BattleReport) ProtoMessage() {}
func (x *BattleReport) ProtoReflect() protoreflect.Message {
mi := &file_battle_battle_msg_proto_msgTypes[7]
mi := &file_battle_battle_msg_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -597,7 +653,7 @@ func (x *BattleReport) ProtoReflect() protoreflect.Message {
// Deprecated: Use BattleReport.ProtoReflect.Descriptor instead.
func (*BattleReport) Descriptor() ([]byte, []int) {
return file_battle_battle_msg_proto_rawDescGZIP(), []int{7}
return file_battle_battle_msg_proto_rawDescGZIP(), []int{8}
}
func (x *BattleReport) GetInfo() *BattleInfo {
@ -614,9 +670,16 @@ func (x *BattleReport) GetCosttime() int32 {
return 0
}
func (x *BattleReport) GetProcess() []byte {
func (x *BattleReport) GetIncmd() []*BattleCmd {
if x != nil {
return x.Process
return x.Incmd
}
return nil
}
func (x *BattleReport) GetOutcmd() []*BattleCmd {
if x != nil {
return x.Outcmd
}
return nil
}
@ -636,13 +699,13 @@ type BattleRpcMessage struct {
Rid uint64 `protobuf:"varint,1,opt,name=rid,proto3" json:"rid"` //服务回调id
Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method"` //方法名
Data *anypb.Any `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data"`
Data *anypb.Any `protobuf:"bytes,3,opt,name=data,proto3" json:"data"` //战斗消息对象
}
func (x *BattleRpcMessage) Reset() {
*x = BattleRpcMessage{}
if protoimpl.UnsafeEnabled {
mi := &file_battle_battle_msg_proto_msgTypes[8]
mi := &file_battle_battle_msg_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -655,7 +718,7 @@ func (x *BattleRpcMessage) String() string {
func (*BattleRpcMessage) ProtoMessage() {}
func (x *BattleRpcMessage) ProtoReflect() protoreflect.Message {
mi := &file_battle_battle_msg_proto_msgTypes[8]
mi := &file_battle_battle_msg_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -668,7 +731,7 @@ func (x *BattleRpcMessage) ProtoReflect() protoreflect.Message {
// Deprecated: Use BattleRpcMessage.ProtoReflect.Descriptor instead.
func (*BattleRpcMessage) Descriptor() ([]byte, []int) {
return file_battle_battle_msg_proto_rawDescGZIP(), []int{8}
return file_battle_battle_msg_proto_rawDescGZIP(), []int{9}
}
func (x *BattleRpcMessage) GetRid() uint64 {
@ -692,32 +755,32 @@ func (x *BattleRpcMessage) GetData() *anypb.Any {
return nil
}
type BattleTestMessage struct {
//战斗校验结果
type BattleCheckResults struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"`
Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg"`
Ischeck bool `protobuf:"varint,1,opt,name=ischeck,proto3" json:"ischeck"` //是否校验成功
}
func (x *BattleTestMessage) Reset() {
*x = BattleTestMessage{}
func (x *BattleCheckResults) Reset() {
*x = BattleCheckResults{}
if protoimpl.UnsafeEnabled {
mi := &file_battle_battle_msg_proto_msgTypes[9]
mi := &file_battle_battle_msg_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BattleTestMessage) String() string {
func (x *BattleCheckResults) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BattleTestMessage) ProtoMessage() {}
func (*BattleCheckResults) ProtoMessage() {}
func (x *BattleTestMessage) ProtoReflect() protoreflect.Message {
mi := &file_battle_battle_msg_proto_msgTypes[9]
func (x *BattleCheckResults) ProtoReflect() protoreflect.Message {
mi := &file_battle_battle_msg_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -728,23 +791,16 @@ func (x *BattleTestMessage) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use BattleTestMessage.ProtoReflect.Descriptor instead.
func (*BattleTestMessage) Descriptor() ([]byte, []int) {
return file_battle_battle_msg_proto_rawDescGZIP(), []int{9}
// Deprecated: Use BattleCheckResults.ProtoReflect.Descriptor instead.
func (*BattleCheckResults) Descriptor() ([]byte, []int) {
return file_battle_battle_msg_proto_rawDescGZIP(), []int{10}
}
func (x *BattleTestMessage) GetId() string {
func (x *BattleCheckResults) GetIscheck() bool {
if x != nil {
return x.Id
return x.Ischeck
}
return ""
}
func (x *BattleTestMessage) GetMsg() string {
if x != nil {
return x.Msg
}
return ""
return false
}
var File_battle_battle_msg_proto protoreflect.FileDescriptor
@ -823,26 +879,32 @@ var file_battle_battle_msg_proto_rawDesc = []byte{
0x32, 0x0e, 0x2e, 0x44, 0x42, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x74,
0x52, 0x09, 0x62, 0x75, 0x6c, 0x65, 0x66, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74,
0x61, 0x73, 0x6b, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05, 0x74, 0x61, 0x73, 0x6b,
0x73, 0x22, 0x89, 0x01, 0x0a, 0x0c, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f,
0x72, 0x74, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69,
0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x6f, 0x73, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x43, 0x6f, 0x73, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x12,
0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c,
0x52, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x6f, 0x6d,
0x70, 0x6c, 0x65, 0x74, 0x65, 0x74, 0x61, 0x73, 0x6b, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52,
0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x74, 0x61, 0x73, 0x6b, 0x22, 0x66, 0x0a,
0x10, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x70, 0x63, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03,
0x72, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x28, 0x0a, 0x04, 0x44,
0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52,
0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x35, 0x0a, 0x11, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x54,
0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73,
0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x42, 0x06, 0x5a, 0x04,
0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x73, 0x22, 0x3b, 0x0a, 0x09, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6d, 0x64, 0x12, 0x18,
0x0a, 0x07, 0x63, 0x6d, 0x64, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x63, 0x6d, 0x64, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xb5,
0x01, 0x0a, 0x0c, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12,
0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e,
0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f,
0x12, 0x1a, 0x0a, 0x08, 0x43, 0x6f, 0x73, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x05, 0x52, 0x08, 0x43, 0x6f, 0x73, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x05,
0x69, 0x6e, 0x63, 0x6d, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x42, 0x61,
0x74, 0x74, 0x6c, 0x65, 0x43, 0x6d, 0x64, 0x52, 0x05, 0x69, 0x6e, 0x63, 0x6d, 0x64, 0x12, 0x22,
0x0a, 0x06, 0x6f, 0x75, 0x74, 0x63, 0x6d, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a,
0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6d, 0x64, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x63,
0x6d, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x74, 0x61,
0x73, 0x6b, 0x18, 0x05, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65,
0x74, 0x65, 0x74, 0x61, 0x73, 0x6b, 0x22, 0x66, 0x0a, 0x10, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65,
0x52, 0x70, 0x63, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x72, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06,
0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65,
0x74, 0x68, 0x6f, 0x64, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x2e,
0x0a, 0x12, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73,
0x75, 0x6c, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x18,
0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x42, 0x06,
0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -857,44 +919,47 @@ func file_battle_battle_msg_proto_rawDescGZIP() []byte {
return file_battle_battle_msg_proto_rawDescData
}
var file_battle_battle_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_battle_battle_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
var file_battle_battle_msg_proto_goTypes = []interface{}{
(*LineUp)(nil), // 0: LineUp
(*BattleFormation)(nil), // 1: BattleFormation
(*BattleEVEReq)(nil), // 2: BattleEVEReq
(*BattlePVEReq)(nil), // 3: BattlePVEReq
(*PVPFormation)(nil), // 4: PVPFormation
(*BattlePVPReq)(nil), // 5: BattlePVPReq
(*BattleInfo)(nil), // 6: BattleInfo
(*BattleReport)(nil), // 7: BattleReport
(*BattleRpcMessage)(nil), // 8: BattleRpcMessage
(*BattleTestMessage)(nil), // 9: BattleTestMessage
(PlayType)(0), // 10: PlayType
(*DBHero)(nil), // 11: DBHero
(BattleType)(0), // 12: BattleType
(*DBBattleFormt)(nil), // 13: DBBattleFormt
(*anypb.Any)(nil), // 14: google.protobuf.Any
(*LineUp)(nil), // 0: LineUp
(*BattleFormation)(nil), // 1: BattleFormation
(*BattleEVEReq)(nil), // 2: BattleEVEReq
(*BattlePVEReq)(nil), // 3: BattlePVEReq
(*PVPFormation)(nil), // 4: PVPFormation
(*BattlePVPReq)(nil), // 5: BattlePVPReq
(*BattleInfo)(nil), // 6: BattleInfo
(*BattleCmd)(nil), // 7: BattleCmd
(*BattleReport)(nil), // 8: BattleReport
(*BattleRpcMessage)(nil), // 9: BattleRpcMessage
(*BattleCheckResults)(nil), // 10: BattleCheckResults
(PlayType)(0), // 11: PlayType
(*DBHero)(nil), // 12: DBHero
(BattleType)(0), // 13: BattleType
(*DBBattleFormt)(nil), // 14: DBBattleFormt
(*anypb.Any)(nil), // 15: google.protobuf.Any
}
var file_battle_battle_msg_proto_depIdxs = []int32{
10, // 0: BattleEVEReq.ptype:type_name -> PlayType
11, // 0: BattleEVEReq.ptype:type_name -> PlayType
1, // 1: BattleEVEReq.format:type_name -> BattleFormation
10, // 2: BattlePVEReq.ptype:type_name -> PlayType
11, // 2: BattlePVEReq.ptype:type_name -> PlayType
1, // 3: BattlePVEReq.format:type_name -> BattleFormation
11, // 4: PVPFormation.format:type_name -> DBHero
10, // 5: BattlePVPReq.ptype:type_name -> PlayType
12, // 4: PVPFormation.format:type_name -> DBHero
11, // 5: BattlePVPReq.ptype:type_name -> PlayType
4, // 6: BattlePVPReq.redformat:type_name -> PVPFormation
4, // 7: BattlePVPReq.buleformat:type_name -> PVPFormation
12, // 8: BattleInfo.btype:type_name -> BattleType
10, // 9: BattleInfo.ptype:type_name -> PlayType
13, // 10: BattleInfo.redflist:type_name -> DBBattleFormt
13, // 11: BattleInfo.buleflist:type_name -> DBBattleFormt
13, // 8: BattleInfo.btype:type_name -> BattleType
11, // 9: BattleInfo.ptype:type_name -> PlayType
14, // 10: BattleInfo.redflist:type_name -> DBBattleFormt
14, // 11: BattleInfo.buleflist:type_name -> DBBattleFormt
6, // 12: BattleReport.info:type_name -> BattleInfo
14, // 13: BattleRpcMessage.Data:type_name -> google.protobuf.Any
14, // [14:14] is the sub-list for method output_type
14, // [14:14] is the sub-list for method input_type
14, // [14:14] is the sub-list for extension type_name
14, // [14:14] is the sub-list for extension extendee
0, // [0:14] is the sub-list for field type_name
7, // 13: BattleReport.incmd:type_name -> BattleCmd
7, // 14: BattleReport.outcmd:type_name -> BattleCmd
15, // 15: BattleRpcMessage.data:type_name -> google.protobuf.Any
16, // [16:16] is the sub-list for method output_type
16, // [16:16] is the sub-list for method input_type
16, // [16:16] is the sub-list for extension type_name
16, // [16:16] is the sub-list for extension extendee
0, // [0:16] is the sub-list for field type_name
}
func init() { file_battle_battle_msg_proto_init() }
@ -990,7 +1055,7 @@ func file_battle_battle_msg_proto_init() {
}
}
file_battle_battle_msg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BattleReport); i {
switch v := v.(*BattleCmd); i {
case 0:
return &v.state
case 1:
@ -1002,7 +1067,7 @@ func file_battle_battle_msg_proto_init() {
}
}
file_battle_battle_msg_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BattleRpcMessage); i {
switch v := v.(*BattleReport); i {
case 0:
return &v.state
case 1:
@ -1014,7 +1079,19 @@ func file_battle_battle_msg_proto_init() {
}
}
file_battle_battle_msg_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BattleTestMessage); i {
switch v := v.(*BattleRpcMessage); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_battle_battle_msg_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BattleCheckResults); i {
case 0:
return &v.state
case 1:
@ -1032,7 +1109,7 @@ func file_battle_battle_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_battle_battle_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 10,
NumMessages: 11,
NumExtensions: 0,
NumServices: 0,
},