上传pvp代码

This commit is contained in:
liwei1dao 2024-03-07 16:34:52 +08:00
parent ce86094621
commit 92903907ca
9 changed files with 121 additions and 160 deletions

View File

@ -500,7 +500,7 @@ type (
//用户离线
UserOffline(roomid string, uid string) (err error)
//创建pvp战斗
CreateRoomById(id string, ptype pb.PvpType, sessions []IUserSession, uinfos []*pb.BaseUserInfo) (err error)
CreateRoomById(id string, ptype pb.PlayType, sessions []IUserSession, uinfos []*pb.BaseUserInfo) (err error)
}
ISmithy interface {

View File

@ -45,7 +45,7 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.PvpListReq) (errdat
list = append(list, &pb.DBPvpBattle{
Id: v.Id,
ServicePath: v.ServicePath,
Ptype: v.Ptype,
Playtype: v.Playtype,
State: v.State,
Red: v.Red,
Blue: v.Blue,

View File

@ -10,7 +10,7 @@ import (
///Pvp 战斗对象
type BattleItem struct {
Id string //战斗id
Ptype pb.PvpType //pvp类型
PlayType pb.PlayType //玩法类型
State pb.PvpState //战斗状态
Red *pb.BaseUserInfo //红方id
RedSession comm.IUserSession //红方连接对象

View File

@ -121,7 +121,7 @@ func (this *Pvp) CreateRoom(sessions []comm.IUserSession, rulesStr string) (room
roomid = primitive.NewObjectID().Hex()
battle = &BattleItem{
Id: roomid,
Ptype: rules.Ptype,
PlayType: rules.Playtype,
State: pb.PvpState_ready,
RedSession: sessions[0],
BlueSession: sessions[1],
@ -157,7 +157,7 @@ func (this *Pvp) CreateRoom(sessions []comm.IUserSession, rulesStr string) (room
}
// 创建Pvp
func (this *Pvp) CreateRoomById(id string, ptype pb.PvpType, sessions []comm.IUserSession, uinfos []*pb.BaseUserInfo) (err error) {
func (this *Pvp) CreateRoomById(id string, ptype pb.PlayType, sessions []comm.IUserSession, uinfos []*pb.BaseUserInfo) (err error) {
this.Debug("CreatePvp", log.Field{Key: "ptype", Value: ptype}, log.Field{Key: "sessions", Value: sessions})
var (
battle *BattleItem
@ -165,7 +165,7 @@ func (this *Pvp) CreateRoomById(id string, ptype pb.PvpType, sessions []comm.IUs
battle = &BattleItem{
Id: id,
Ptype: ptype,
PlayType: ptype,
State: pb.PvpState_ready,
RedSession: sessions[0],
BlueSession: sessions[1],
@ -178,15 +178,7 @@ func (this *Pvp) CreateRoomById(id string, ptype pb.PvpType, sessions []comm.IUs
this.lock.Lock()
this.battles[battle.Id] = battle
this.lock.Unlock()
if err = this.SendMsgToSession(string(comm.ModulePvp), "ready", &pb.PvpReadyPush{
ServicePath: fmt.Sprintf("%s/%s", this.service.GetType(), this.service.GetId()),
Battleid: battle.Id,
Red: battle.Red,
Blue: battle.Blue,
Countdown: 60,
}, battle.RedSession, battle.BlueSession); err != nil {
this.Errorln(err)
}
go this.startBattle(battle)
return
}
@ -267,14 +259,14 @@ func (this *Pvp) PvpFinishPush(out *pb.BattleFinishPush) {
this.lock.RLock()
delete(this.battles, out.Battleid)
this.lock.RUnlock()
switch battle.Ptype {
case pb.PvpType_friends:
switch battle.PlayType {
case pb.PlayType_friendsmeet:
go func() {
this.gameInvite.GameInviteEnd(3, battle.Red.Uid)
this.practice.ChallengeResults(out.Battleid, battle.Red.Uid, battle.Blue.Uid, out.WinSide)
}()
break
case pb.PvpType_realarena:
case pb.PlayType_realarena:
go func() {
this.realarena.ChallengeResults(out.Battleid, battle.Red.Uid, battle.Blue.Uid, out.WinSide)
}()
@ -318,8 +310,8 @@ func (this *Pvp) readyTimeOut(task *timewheel.Task, args ...interface{}) {
this.Errorln(err)
}
switch battle.Ptype {
case pb.PvpType_friends:
switch battle.PlayType {
case pb.PlayType_friendsmeet:
var winside int32 = 0
if battle.Redformation != nil {
winside = 1
@ -379,7 +371,7 @@ func (this *Pvp) startBattle(battle *BattleItem) {
)
if errdata, record = this.battle.CreateRtPvpBattle(&pb.BattleRTPVPReq{
Rulesid: 111,
Ptype: pb.PlayType_friendsmeet,
Ptype: battle.PlayType,
Title: "",
RedCompId: battle.Red.Uid,
Redformat: []*pb.BattleFormation{battle.Redformation},
@ -421,7 +413,8 @@ func (this *Pvp) startBattle(battle *BattleItem) {
}
} else {
if err = this.SendMsgToSession(string(comm.ModulePvp), "start", &pb.PvpStartPush{
Info: info,
ServicePath: fmt.Sprintf("%s/%s", this.service.GetType(), this.service.GetId()),
Info: info,
}, battle.RedSession, battle.BlueSession); err != nil {
this.Errorln(err)
}
@ -429,7 +422,7 @@ func (this *Pvp) startBattle(battle *BattleItem) {
this.modelPvpComp.addpvp(&pb.DBPvpBattle{
Id: info.Id,
ServicePath: fmt.Sprintf("%s/%s", this.service.GetType(), this.service.GetId()),
Ptype: battle.Ptype,
Playtype: battle.PlayType,
State: battle.State,
Red: battle.Red,
Blue: battle.Blue,

View File

@ -82,7 +82,7 @@ func (this *RealArena) createroom(red, bule *pb.DBRealArenaMember) (room *Room,
)
room = &Room{
Id: primitive.NewObjectID().Hex(),
ServicePath: fmt.Sprintf("%s", this.service.GetId()),
ServicePath: fmt.Sprintf("%s/%s", this.service.GetType(), this.service.GetId()),
sessions: make([]comm.IUserSession, 0),
members: make([]*pb.DBRealArenaMember, 0),
}

View File

@ -141,7 +141,7 @@ func (this *Room) selectleader(uid string, index int32) (err error) {
if finish {
var uinfos []*pb.BaseUserInfo = make([]*pb.BaseUserInfo, 0)
uinfos = append(uinfos, this.members[0].User, this.members[1].User)
err = this.module.pvp.CreateRoomById(this.Id, pb.PvpType_realarena, this.sessions, uinfos)
err = this.module.pvp.CreateRoomById(this.Id, pb.PlayType_realarena, this.sessions, uinfos)
}
return

View File

@ -109,6 +109,7 @@ const (
PlayType_integral PlayType = 21 //积分boss
PlayType_plunder PlayType = 22 // 掠夺
PlayType_plunderpvp PlayType = 23 // 掠夺pvp
PlayType_realarena PlayType = 24 //实时竞技场
)
// Enum value maps for PlayType.
@ -138,6 +139,7 @@ var (
21: "integral",
22: "plunder",
23: "plunderpvp",
24: "realarena",
}
PlayType_value = map[string]int32{
"null": 0,
@ -164,6 +166,7 @@ var (
"integral": 21,
"plunder": 22,
"plunderpvp": 23,
"realarena": 24,
}
)
@ -858,7 +861,7 @@ var file_battle_battle_db_proto_rawDesc = []byte{
0x65, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x70, 0x76, 0x70, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03,
0x70, 0x76, 0x62, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x65, 0x76, 0x65, 0x10, 0x04, 0x12, 0x09,
0x0a, 0x05, 0x72, 0x74, 0x70, 0x76, 0x70, 0x10, 0x05, 0x12, 0x08, 0x0a, 0x04, 0x6c, 0x70, 0x65,
0x76, 0x10, 0x06, 0x2a, 0xc7, 0x02, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x79, 0x54, 0x79, 0x70, 0x65,
0x76, 0x10, 0x06, 0x2a, 0xd6, 0x02, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x79, 0x54, 0x79, 0x70, 0x65,
0x12, 0x08, 0x0a, 0x04, 0x6e, 0x75, 0x6c, 0x6c, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x6d, 0x61,
0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x70, 0x61, 0x67, 0x6f,
0x64, 0x61, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x10, 0x03, 0x12,
@ -878,13 +881,14 @@ var file_battle_battle_db_proto_rawDesc = []byte{
0x62, 0x6f, 0x6f, 0x73, 0x10, 0x13, 0x12, 0x0a, 0x0a, 0x06, 0x69, 0x73, 0x4c, 0x61, 0x6e, 0x64,
0x10, 0x14, 0x12, 0x0c, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x10, 0x15,
0x12, 0x0b, 0x0a, 0x07, 0x70, 0x6c, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x10, 0x16, 0x12, 0x0e, 0x0a,
0x0a, 0x70, 0x6c, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x70, 0x76, 0x70, 0x10, 0x17, 0x2a, 0x1f, 0x0a,
0x0c, 0x42, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x06, 0x0a,
0x02, 0x69, 0x6e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x10, 0x02, 0x2a, 0x2b,
0x0a, 0x0c, 0x44, 0x42, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x12, 0x08,
0x0a, 0x04, 0x64, 0x72, 0x61, 0x77, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x10,
0x01, 0x12, 0x08, 0x0a, 0x04, 0x62, 0x75, 0x6c, 0x65, 0x10, 0x02, 0x42, 0x06, 0x5a, 0x04, 0x2e,
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x0a, 0x70, 0x6c, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x70, 0x76, 0x70, 0x10, 0x17, 0x12, 0x0d, 0x0a,
0x09, 0x72, 0x65, 0x61, 0x6c, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x10, 0x18, 0x2a, 0x1f, 0x0a, 0x0c,
0x42, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x06, 0x0a, 0x02,
0x69, 0x6e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x10, 0x02, 0x2a, 0x2b, 0x0a,
0x0c, 0x44, 0x42, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x12, 0x08, 0x0a,
0x04, 0x64, 0x72, 0x61, 0x77, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x10, 0x01,
0x12, 0x08, 0x0a, 0x04, 0x62, 0x75, 0x6c, 0x65, 0x10, 0x02, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -20,53 +20,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
//Pvp类型
type PvpType int32
const (
PvpType_friends PvpType = 0 //好友切磋
PvpType_realarena PvpType = 1 //实时竞技场
)
// Enum value maps for PvpType.
var (
PvpType_name = map[int32]string{
0: "friends",
1: "realarena",
}
PvpType_value = map[string]int32{
"friends": 0,
"realarena": 1,
}
)
func (x PvpType) Enum() *PvpType {
p := new(PvpType)
*p = x
return p
}
func (x PvpType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (PvpType) Descriptor() protoreflect.EnumDescriptor {
return file_pvp_pvp_db_proto_enumTypes[0].Descriptor()
}
func (PvpType) Type() protoreflect.EnumType {
return &file_pvp_pvp_db_proto_enumTypes[0]
}
func (x PvpType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use PvpType.Descriptor instead.
func (PvpType) EnumDescriptor() ([]byte, []int) {
return file_pvp_pvp_db_proto_rawDescGZIP(), []int{0}
}
type PvpState int32
const (
@ -106,11 +59,11 @@ func (x PvpState) String() string {
}
func (PvpState) Descriptor() protoreflect.EnumDescriptor {
return file_pvp_pvp_db_proto_enumTypes[1].Descriptor()
return file_pvp_pvp_db_proto_enumTypes[0].Descriptor()
}
func (PvpState) Type() protoreflect.EnumType {
return &file_pvp_pvp_db_proto_enumTypes[1]
return &file_pvp_pvp_db_proto_enumTypes[0]
}
func (x PvpState) Number() protoreflect.EnumNumber {
@ -119,7 +72,7 @@ func (x PvpState) Number() protoreflect.EnumNumber {
// Deprecated: Use PvpState.Descriptor instead.
func (PvpState) EnumDescriptor() ([]byte, []int) {
return file_pvp_pvp_db_proto_rawDescGZIP(), []int{1}
return file_pvp_pvp_db_proto_rawDescGZIP(), []int{0}
}
//游戏规则
@ -128,7 +81,7 @@ type DBPvpRules struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Ptype PvpType `protobuf:"varint,1,opt,name=ptype,proto3,enum=PvpType" json:"ptype"`
Playtype PlayType `protobuf:"varint,1,opt,name=playtype,proto3,enum=PlayType" json:"playtype"`
}
func (x *DBPvpRules) Reset() {
@ -163,11 +116,11 @@ func (*DBPvpRules) Descriptor() ([]byte, []int) {
return file_pvp_pvp_db_proto_rawDescGZIP(), []int{0}
}
func (x *DBPvpRules) GetPtype() PvpType {
func (x *DBPvpRules) GetPlaytype() PlayType {
if x != nil {
return x.Ptype
return x.Playtype
}
return PvpType_friends
return PlayType_null
}
type DBPvpBattle struct {
@ -175,12 +128,12 @@ type DBPvpBattle struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` //战斗id
ServicePath string `protobuf:"bytes,2,opt,name=servicePath,proto3" json:"servicePath"` //战斗区服地址
Ptype PvpType `protobuf:"varint,3,opt,name=ptype,proto3,enum=PvpType" json:"ptype"` //pvp类型
State PvpState `protobuf:"varint,4,opt,name=state,proto3,enum=PvpState" json:"state"` //战斗状态
Red *BaseUserInfo `protobuf:"bytes,5,opt,name=red,proto3" json:"red"` //红方id
Blue *BaseUserInfo `protobuf:"bytes,6,opt,name=blue,proto3" json:"blue"` //红方id
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` //战斗id
ServicePath string `protobuf:"bytes,2,opt,name=servicePath,proto3" json:"servicePath"` //战斗区服地址
Playtype PlayType `protobuf:"varint,3,opt,name=playtype,proto3,enum=PlayType" json:"playtype"` //pvp类型
State PvpState `protobuf:"varint,4,opt,name=state,proto3,enum=PvpState" json:"state"` //战斗状态
Red *BaseUserInfo `protobuf:"bytes,5,opt,name=red,proto3" json:"red"` //红方id
Blue *BaseUserInfo `protobuf:"bytes,6,opt,name=blue,proto3" json:"blue"` //红方id
}
func (x *DBPvpBattle) Reset() {
@ -229,11 +182,11 @@ func (x *DBPvpBattle) GetServicePath() string {
return ""
}
func (x *DBPvpBattle) GetPtype() PvpType {
func (x *DBPvpBattle) GetPlaytype() PlayType {
if x != nil {
return x.Ptype
return x.Playtype
}
return PvpType_friends
return PlayType_null
}
func (x *DBPvpBattle) GetState() PvpState {
@ -261,30 +214,30 @@ var File_pvp_pvp_db_proto protoreflect.FileDescriptor
var file_pvp_pvp_db_proto_rawDesc = []byte{
0x0a, 0x10, 0x70, 0x76, 0x70, 0x2f, 0x70, 0x76, 0x70, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2c,
0x0a, 0x0a, 0x44, 0x42, 0x50, 0x76, 0x70, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x05,
0x70, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x08, 0x2e, 0x50, 0x76,
0x70, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x70, 0x74, 0x79, 0x70, 0x65, 0x22, 0xc4, 0x01, 0x0a,
0x0b, 0x44, 0x42, 0x50, 0x76, 0x70, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x12, 0x0e, 0x0a, 0x02,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b,
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1e,
0x0a, 0x05, 0x70, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x08, 0x2e,
0x50, 0x76, 0x70, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x70, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1f,
0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e,
0x50, 0x76, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12,
0x1f, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42,
0x61, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x03, 0x72, 0x65, 0x64,
0x12, 0x21, 0x0a, 0x04, 0x62, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d,
0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x62,
0x6c, 0x75, 0x65, 0x2a, 0x25, 0x0a, 0x07, 0x50, 0x76, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b,
0x0a, 0x07, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x73, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x72,
0x65, 0x61, 0x6c, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x10, 0x01, 0x2a, 0x43, 0x0a, 0x08, 0x50, 0x76,
0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x76, 0x6f, 0x69, 0x64, 0x10, 0x00,
0x12, 0x09, 0x0a, 0x05, 0x72, 0x65, 0x61, 0x64, 0x79, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x62,
0x61, 0x74, 0x74, 0x6c, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65,
0x6c, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x10, 0x04, 0x42,
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16,
0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x2f, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x5f, 0x64, 0x62,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x33, 0x0a, 0x0a, 0x44, 0x42, 0x50, 0x76, 0x70, 0x52,
0x75, 0x6c, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x74, 0x79, 0x70, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x54, 0x79, 0x70,
0x65, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x74, 0x79, 0x70, 0x65, 0x22, 0xcb, 0x01, 0x0a, 0x0b,
0x44, 0x42, 0x50, 0x76, 0x70, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x73,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x25, 0x0a,
0x08, 0x70, 0x6c, 0x61, 0x79, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32,
0x09, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79,
0x74, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20,
0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x50, 0x76, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05,
0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1f, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66,
0x6f, 0x52, 0x03, 0x72, 0x65, 0x64, 0x12, 0x21, 0x0a, 0x04, 0x62, 0x6c, 0x75, 0x65, 0x18, 0x06,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49,
0x6e, 0x66, 0x6f, 0x52, 0x04, 0x62, 0x6c, 0x75, 0x65, 0x2a, 0x43, 0x0a, 0x08, 0x50, 0x76, 0x70,
0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x76, 0x6f, 0x69, 0x64, 0x10, 0x00, 0x12,
0x09, 0x0a, 0x05, 0x72, 0x65, 0x61, 0x64, 0x79, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x62, 0x61,
0x74, 0x74, 0x6c, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c,
0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x10, 0x04, 0x42, 0x06,
0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -299,19 +252,19 @@ func file_pvp_pvp_db_proto_rawDescGZIP() []byte {
return file_pvp_pvp_db_proto_rawDescData
}
var file_pvp_pvp_db_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_pvp_pvp_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_pvp_pvp_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_pvp_pvp_db_proto_goTypes = []interface{}{
(PvpType)(0), // 0: PvpType
(PvpState)(0), // 1: PvpState
(*DBPvpRules)(nil), // 2: DBPvpRules
(*DBPvpBattle)(nil), // 3: DBPvpBattle
(PvpState)(0), // 0: PvpState
(*DBPvpRules)(nil), // 1: DBPvpRules
(*DBPvpBattle)(nil), // 2: DBPvpBattle
(PlayType)(0), // 3: PlayType
(*BaseUserInfo)(nil), // 4: BaseUserInfo
}
var file_pvp_pvp_db_proto_depIdxs = []int32{
0, // 0: DBPvpRules.ptype:type_name -> PvpType
0, // 1: DBPvpBattle.ptype:type_name -> PvpType
1, // 2: DBPvpBattle.state:type_name -> PvpState
3, // 0: DBPvpRules.playtype:type_name -> PlayType
3, // 1: DBPvpBattle.playtype:type_name -> PlayType
0, // 2: DBPvpBattle.state:type_name -> PvpState
4, // 3: DBPvpBattle.red:type_name -> BaseUserInfo
4, // 4: DBPvpBattle.blue:type_name -> BaseUserInfo
5, // [5:5] is the sub-list for method output_type
@ -327,6 +280,7 @@ func file_pvp_pvp_db_proto_init() {
return
}
file_comm_proto_init()
file_battle_battle_db_proto_init()
if !protoimpl.UnsafeEnabled {
file_pvp_pvp_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBPvpRules); i {
@ -358,7 +312,7 @@ func file_pvp_pvp_db_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pvp_pvp_db_proto_rawDesc,
NumEnums: 2,
NumEnums: 1,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,

View File

@ -719,8 +719,9 @@ type PvpStartPush struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=ErrorCode" json:"code"` //是否成功
Info *BattleInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info"`
Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=ErrorCode" json:"code"` //是否成功
ServicePath string `protobuf:"bytes,2,opt,name=servicePath,proto3" json:"servicePath"` //战斗区服地址
Info *BattleInfo `protobuf:"bytes,3,opt,name=info,proto3" json:"info"`
}
func (x *PvpStartPush) Reset() {
@ -762,6 +763,13 @@ func (x *PvpStartPush) GetCode() ErrorCode {
return ErrorCode_Success
}
func (x *PvpStartPush) GetServicePath() string {
if x != nil {
return x.ServicePath
}
return ""
}
func (x *PvpStartPush) GetInfo() *BattleInfo {
if x != nil {
return x.Info
@ -1153,38 +1161,40 @@ var file_pvp_pvp_msg_proto_rawDesc = []byte{
0x52, 0x09, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x2a, 0x0a, 0x10, 0x50,
0x76, 0x70, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12,
0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x22, 0x4f, 0x0a, 0x0c, 0x50, 0x76, 0x70, 0x53, 0x74,
0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x22, 0x71, 0x0a, 0x0c, 0x50, 0x76, 0x70, 0x53, 0x74,
0x61, 0x72, 0x74, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1e, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64,
0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x6e,
0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x49, 0x0a, 0x0d, 0x50, 0x76, 0x70, 0x4f,
0x75, 0x74, 0x43, 0x6d, 0x64, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x61, 0x74,
0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69,
0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66,
0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65,
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x49, 0x0a, 0x0d, 0x50, 0x76,
0x70, 0x4f, 0x75, 0x74, 0x43, 0x6d, 0x64, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x62,
0x61, 0x74, 0x74, 0x6c, 0x65, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62,
0x61, 0x74, 0x74, 0x6c, 0x65, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x02,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6d, 0x64,
0x52, 0x03, 0x63, 0x6d, 0x64, 0x22, 0x47, 0x0a, 0x0b, 0x50, 0x76, 0x70, 0x49, 0x6e, 0x43, 0x6d,
0x64, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x69, 0x64,
0x12, 0x1c, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e,
0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6d, 0x64, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x22, 0x68,
0x0a, 0x0c, 0x50, 0x76, 0x70, 0x49, 0x6e, 0x43, 0x6d, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e,
0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x45,
0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1a,
0x0a, 0x08, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x08, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x03, 0x63, 0x6d,
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65,
0x43, 0x6d, 0x64, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x22, 0x2b, 0x0a, 0x0d, 0x50, 0x76, 0x70, 0x46,
0x69, 0x6e, 0x69, 0x73, 0x68, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x61, 0x74,
0x74, 0x6c, 0x65, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x61, 0x74,
0x74, 0x6c, 0x65, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x02, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6d, 0x64, 0x52, 0x03,
0x63, 0x6d, 0x64, 0x22, 0x47, 0x0a, 0x0b, 0x50, 0x76, 0x70, 0x49, 0x6e, 0x43, 0x6d, 0x64, 0x52,
0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x69, 0x64, 0x12, 0x1c,
0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x42, 0x61,
0x74, 0x74, 0x6c, 0x65, 0x43, 0x6d, 0x64, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x22, 0x68, 0x0a, 0x0c,
0x50, 0x76, 0x70, 0x49, 0x6e, 0x43, 0x6d, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04,
0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x45, 0x72, 0x72,
0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08,
0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18,
0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6d,
0x64, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x22, 0x2b, 0x0a, 0x0d, 0x50, 0x76, 0x70, 0x46, 0x69, 0x6e,
0x69, 0x73, 0x68, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x61, 0x74, 0x74, 0x6c,
0x65, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x61, 0x74, 0x74, 0x6c,
0x65, 0x69, 0x64, 0x22, 0x45, 0x0a, 0x15, 0x52, 0x50, 0x43, 0x5f, 0x50, 0x56, 0x50, 0x54, 0x72,
0x75, 0x73, 0x74, 0x65, 0x65, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08,
0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08,
0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x18, 0x0a, 0x16, 0x52, 0x50,
0x43, 0x5f, 0x50, 0x56, 0x50, 0x54, 0x72, 0x75, 0x73, 0x74, 0x65, 0x65, 0x73, 0x68, 0x69, 0x70,
0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
0x74, 0x6c, 0x65, 0x69, 0x64, 0x22, 0x45, 0x0a, 0x15, 0x52, 0x50, 0x43, 0x5f, 0x50, 0x56, 0x50,
0x54, 0x72, 0x75, 0x73, 0x74, 0x65, 0x65, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, 0x12, 0x1a,
0x0a, 0x08, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09,
0x52, 0x08, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x18, 0x0a, 0x16,
0x52, 0x50, 0x43, 0x5f, 0x50, 0x56, 0x50, 0x54, 0x72, 0x75, 0x73, 0x74, 0x65, 0x65, 0x73, 0x68,
0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (