上传战斗业务对接接口
This commit is contained in:
parent
b838460200
commit
526e32e708
@ -137,5 +137,7 @@ type (
|
||||
CreatePveBattle(session IUserSession, req *pb.BattlePVEReq) (code pb.ErrorCode, record *pb.DBBattleRecord)
|
||||
///创建pvb战斗
|
||||
CreatePvbBattle(session IUserSession, req *pb.BattlePVEReq) (code pb.ErrorCode, record *pb.DBBattleRecord)
|
||||
//校验战报
|
||||
CheckBattleReport(session IUserSession, report *pb.BattleReport) (code pb.ErrorCode, iswin bool)
|
||||
}
|
||||
)
|
||||
|
@ -58,15 +58,6 @@ func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVE
|
||||
if record, code = this.modelBattle.createpve(session, pb.BattleType_pve, req); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
// this.pushbattle(session, &pb.BattleStartPush{
|
||||
// Id: record.Id,
|
||||
// Btype: record.Btype,
|
||||
// Ptype: record.Ptype,
|
||||
// RedCompId: record.RedCompId,
|
||||
// Redflist: record.Redflist,
|
||||
// BlueCompId: record.BlueCompId,
|
||||
// Buleflist: record.Buleflist,
|
||||
// })
|
||||
return
|
||||
}
|
||||
|
||||
@ -75,19 +66,10 @@ func (this *Battle) CreatePvbBattle(session comm.IUserSession, req *pb.BattlePVE
|
||||
if record, code = this.modelBattle.createpve(session, pb.BattleType_pvb, req); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
// this.pushbattle(session, &pb.BattleStartPush{
|
||||
// Id: record.Id,
|
||||
// Btype: record.Btype,
|
||||
// Ptype: record.Ptype,
|
||||
// RedCompId: record.RedCompId,
|
||||
// Redflist: record.Redflist,
|
||||
// BlueCompId: record.BlueCompId,
|
||||
// Buleflist: record.Buleflist,
|
||||
// })
|
||||
return
|
||||
}
|
||||
|
||||
//推送战斗开始数据
|
||||
// func (this *Battle) pushbattle(session comm.IUserSession, resp *pb.BattleStartPush) {
|
||||
// session.SendMsg(string(this.GetType()), "start", resp)
|
||||
// }
|
||||
//校验战报是否成功
|
||||
func (this *Battle) CheckBattleReport(session comm.IUserSession, report *pb.BattleReport) (code pb.ErrorCode, iswin bool) {
|
||||
return pb.ErrorCode_Success, true
|
||||
}
|
||||
|
@ -16,11 +16,12 @@ func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.Moonfantasy
|
||||
return
|
||||
}
|
||||
|
||||
///询问怪物是否可以挑战
|
||||
///领取战斗奖励
|
||||
func (this *apiComp) Receive(session comm.IUserSession, req *pb.MoonfantasyReceiveReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
boss *cfg.GameDreamlandBoosData
|
||||
award []*cfg.Gameatn = make([]*cfg.Gameatn, 0)
|
||||
iswin bool
|
||||
err error
|
||||
)
|
||||
|
||||
@ -31,7 +32,13 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.MoonfantasyRecei
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
|
||||
if code, iswin = this.module.battle.CheckBattleReport(session, req.Report); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
if iswin {
|
||||
code = pb.ErrorCode_MoonfantasyBattleNoWin
|
||||
return
|
||||
}
|
||||
this.module.configure.GetDropReward(boss.Prize, award)
|
||||
this.module.DispenseRes(session, award, true)
|
||||
session.SendMsg(string(this.module.GetType()), "receive", &pb.MoonfantasyReceiveResp{Issucc: true})
|
||||
|
@ -188,6 +188,45 @@ func (x *BattleInfo) GetBuleflist() []*DBBattleFormt {
|
||||
return nil
|
||||
}
|
||||
|
||||
//战报数据
|
||||
type BattleReport struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *BattleReport) Reset() {
|
||||
*x = BattleReport{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_battle_battle_msg_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *BattleReport) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*BattleReport) ProtoMessage() {}
|
||||
|
||||
func (x *BattleReport) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_battle_battle_msg_proto_msgTypes[2]
|
||||
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 BattleReport.ProtoReflect.Descriptor instead.
|
||||
func (*BattleReport) Descriptor() ([]byte, []int) {
|
||||
return file_battle_battle_msg_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
var File_battle_battle_msg_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_battle_battle_msg_proto_rawDesc = []byte{
|
||||
@ -217,7 +256,8 @@ var file_battle_battle_msg_proto_rawDesc = []byte{
|
||||
0x09, 0x52, 0x0a, 0x62, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x49, 0x64, 0x12, 0x2c, 0x0a,
|
||||
0x09, 0x62, 0x75, 0x6c, 0x65, 0x66, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b,
|
||||
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, 0x42, 0x06, 0x5a, 0x04, 0x2e,
|
||||
0x52, 0x09, 0x62, 0x75, 0x6c, 0x65, 0x66, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x0e, 0x0a, 0x0c, 0x42,
|
||||
0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e,
|
||||
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
@ -233,20 +273,21 @@ 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, 2)
|
||||
var file_battle_battle_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_battle_battle_msg_proto_goTypes = []interface{}{
|
||||
(*BattlePVEReq)(nil), // 0: BattlePVEReq
|
||||
(*BattleInfo)(nil), // 1: BattleInfo
|
||||
(PlayType)(0), // 2: PlayType
|
||||
(BattleType)(0), // 3: BattleType
|
||||
(*DBBattleFormt)(nil), // 4: DBBattleFormt
|
||||
(*BattleReport)(nil), // 2: BattleReport
|
||||
(PlayType)(0), // 3: PlayType
|
||||
(BattleType)(0), // 4: BattleType
|
||||
(*DBBattleFormt)(nil), // 5: DBBattleFormt
|
||||
}
|
||||
var file_battle_battle_msg_proto_depIdxs = []int32{
|
||||
2, // 0: BattlePVEReq.ptype:type_name -> PlayType
|
||||
3, // 1: BattleInfo.btype:type_name -> BattleType
|
||||
2, // 2: BattleInfo.ptype:type_name -> PlayType
|
||||
4, // 3: BattleInfo.redflist:type_name -> DBBattleFormt
|
||||
4, // 4: BattleInfo.buleflist:type_name -> DBBattleFormt
|
||||
3, // 0: BattlePVEReq.ptype:type_name -> PlayType
|
||||
4, // 1: BattleInfo.btype:type_name -> BattleType
|
||||
3, // 2: BattleInfo.ptype:type_name -> PlayType
|
||||
5, // 3: BattleInfo.redflist:type_name -> DBBattleFormt
|
||||
5, // 4: BattleInfo.buleflist:type_name -> DBBattleFormt
|
||||
5, // [5:5] is the sub-list for method output_type
|
||||
5, // [5:5] is the sub-list for method input_type
|
||||
5, // [5:5] is the sub-list for extension type_name
|
||||
@ -285,6 +326,18 @@ func file_battle_battle_msg_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_battle_battle_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*BattleReport); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
@ -292,7 +345,7 @@ func file_battle_battle_msg_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_battle_battle_msg_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
@ -394,7 +394,7 @@ type MoonfantasyReceiveReq struct {
|
||||
|
||||
Bid string `protobuf:"bytes,2,opt,name=bid,proto3" json:"bid"` //战斗id 后续需要这个id来领取奖励
|
||||
Monster string `protobuf:"bytes,3,opt,name=monster,proto3" json:"monster"` //怪物id
|
||||
Iswin bool `protobuf:"varint,4,opt,name=iswin,proto3" json:"iswin"` //是否胜利
|
||||
Report *BattleReport `protobuf:"bytes,4,opt,name=report,proto3" json:"report"` //战报
|
||||
}
|
||||
|
||||
func (x *MoonfantasyReceiveReq) Reset() {
|
||||
@ -443,11 +443,11 @@ func (x *MoonfantasyReceiveReq) GetMonster() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *MoonfantasyReceiveReq) GetIswin() bool {
|
||||
func (x *MoonfantasyReceiveReq) GetReport() *BattleReport {
|
||||
if x != nil {
|
||||
return x.Iswin
|
||||
return x.Report
|
||||
}
|
||||
return false
|
||||
return nil
|
||||
}
|
||||
|
||||
///领取战斗奖励
|
||||
@ -538,17 +538,18 @@ var file_moonfantasy_moonfantasy_msg_proto_rawDesc = []byte{
|
||||
0x6d, 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d,
|
||||
0x6f, 0x6e, 0x73, 0x74, 0x65, 0x72, 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, 0x59, 0x0a, 0x15, 0x4d, 0x6f, 0x6f, 0x6e, 0x66,
|
||||
0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x6a, 0x0a, 0x15, 0x4d, 0x6f, 0x6f, 0x6e, 0x66,
|
||||
0x61, 0x6e, 0x74, 0x61, 0x73, 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x62, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x62,
|
||||
0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05,
|
||||
0x69, 0x73, 0x77, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, 0x73, 0x77,
|
||||
0x69, 0x6e, 0x22, 0x30, 0x0a, 0x16, 0x4d, 0x6f, 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61, 0x73,
|
||||
0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x72, 0x12, 0x25, 0x0a, 0x06,
|
||||
0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42,
|
||||
0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x06, 0x72, 0x65, 0x70,
|
||||
0x6f, 0x72, 0x74, 0x22, 0x30, 0x0a, 0x16, 0x4d, 0x6f, 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61,
|
||||
0x73, 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -575,16 +576,18 @@ var file_moonfantasy_moonfantasy_msg_proto_goTypes = []interface{}{
|
||||
(*MoonfantasyReceiveResp)(nil), // 7: MoonfantasyReceiveResp
|
||||
(ErrorCode)(0), // 8: ErrorCode
|
||||
(*BattleInfo)(nil), // 9: BattleInfo
|
||||
(*BattleReport)(nil), // 10: BattleReport
|
||||
}
|
||||
var file_moonfantasy_moonfantasy_msg_proto_depIdxs = []int32{
|
||||
8, // 0: MoonfantasyAskResp.code:type_name -> ErrorCode
|
||||
8, // 1: MoonfantasyBattleResp.code:type_name -> ErrorCode
|
||||
9, // 2: MoonfantasyBattleResp.info:type_name -> BattleInfo
|
||||
3, // [3:3] is the sub-list for method output_type
|
||||
3, // [3:3] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
10, // 3: MoonfantasyReceiveReq.report:type_name -> BattleReport
|
||||
4, // [4:4] is the sub-list for method output_type
|
||||
4, // [4:4] is the sub-list for method input_type
|
||||
4, // [4:4] is the sub-list for extension type_name
|
||||
4, // [4:4] is the sub-list for extension extendee
|
||||
0, // [0:4] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_moonfantasy_moonfantasy_msg_proto_init() }
|
||||
|
Loading…
Reference in New Issue
Block a user