上传战斗远程校验

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 ( import (
"context" "context"
"go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"sync" "sync"
"sync/atomic"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/core/cbase"
"go_dreamfactory/lego/sys/log" "go_dreamfactory/lego/sys/log"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
@ -18,50 +19,83 @@ import (
战斗服务客户端组件 战斗服务客户端组件
*/ */
type clientComp struct { type clientComp struct {
modules.MCompGate cbase.ModuleCompBase
options *Options options *Options
service core.IService service core.IService
module *Battle module *Battle
mutexs []sync.Mutex
clinets []*client clinets []*client
i int i int
} }
//组件初始化接口 //组件初始化接口
func (this *clientComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { 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.options = options.(*Options)
this.module = module.(*Battle) this.module = module.(*Battle)
this.mutexs = make([]sync.Mutex, len(this.options.BattleServerAddr))
this.clinets = make([]*client, len(this.options.BattleServerAddr)) this.clinets = make([]*client, len(this.options.BattleServerAddr))
return return
} }
func (this *clientComp) Start() (err error) { func (this *clientComp) Start() (err error) {
err = this.MCompGate.Start() err = this.ModuleCompBase.Start()
for i, v := range this.options.BattleServerAddr { 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
} }
} }
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) func (this *clientComp) Shutdown(c *client) {
this.i += 1 this.mutexs[c.index].Lock()
err = this.clinets[i].callBattle(ctx, method, req, reply) 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 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{} dialer := websocket.Dialer{}
c.conn, _, err = dialer.Dial(addr, nil) c.conn, _, err = dialer.Dial(addr, nil)
return return
} }
type client struct { type client struct {
mgr IClientMgr
log log.ILogger log log.ILogger
index int
conn *websocket.Conn conn *websocket.Conn
state int32 //状态 0 关闭 1 运行 2 关闭中
seq uint64 seq uint64
pendingmutex sync.Mutex pendingmutex sync.Mutex
pending map[uint64]*MessageCall //高并发回调 pending map[uint64]*MessageCall //高并发回调
@ -117,11 +151,12 @@ locp:
for { for {
if _, data, err = this.conn.ReadMessage(); err != nil { if _, data, err = this.conn.ReadMessage(); err != nil {
this.log.Errorf("client err:%v", err) this.log.Errorf("client err:%v", err)
this.Close()
break locp break locp
} }
if err = proto.Unmarshal(data, msg); err != nil { if err = proto.Unmarshal(data, msg); err != nil {
this.log.Errorf("client Unmarshal err:%v", err) this.log.Errorf("client Unmarshal err:%v", err)
break locp continue
} }
go this.handleresponse(msg) go this.handleresponse(msg)
} }
@ -136,3 +171,13 @@ func (this *client) handleresponse(resp *pb.BattleRpcMessage) {
call.Error = resp.Data.UnmarshalTo(call.Reply) call.Error = resp.Data.UnmarshalTo(call.Reply)
call.done(this.log) 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 package battle
import ( import (
"context"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/base" "go_dreamfactory/lego/base"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"go_dreamfactory/sys/db" "go_dreamfactory/sys/db"
"time"
) )
/* /*
@ -22,11 +25,13 @@ func NewModule() core.IModule {
type Battle struct { type Battle struct {
modules.ModuleBase modules.ModuleBase
service base.IRPCXService service base.IRPCXService
options *Options
friend comm.IFriend //好友系统 friend comm.IFriend //好友系统
moonfantasy comm.IMoonFantasy //月之秘境模块 moonfantasy comm.IMoonFantasy //月之秘境模块
api_comp *apiComp api_comp *apiComp
configure *configureComp configure *configureComp
modelBattle *modelBattleComp modelBattle *modelBattleComp
clients *clientComp
} }
//模块名 //模块名
@ -34,10 +39,15 @@ func (this *Battle) GetType() core.M_Modules {
return comm.ModuleBattle 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) { func (this *Battle) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options) err = this.ModuleBase.Init(service, module, options)
this.service = service.(base.IRPCXService) this.service = service.(base.IRPCXService)
this.options = options.(*Options)
return return
} }
func (this *Battle) Start() (err error) { func (this *Battle) Start() (err error) {
@ -60,6 +70,7 @@ func (this *Battle) OnInstallComp() {
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp) this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp) this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
this.modelBattle = this.RegisterComp(new(modelBattleComp)).(*modelBattleComp) 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) { 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) this.moonfantasy.Trigger(session, report)
return pb.ErrorCode_Success, true return pb.ErrorCode_Success, true
} }

View File

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

View File

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

View File

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