This commit is contained in:
wh_zcy 2022-11-14 15:55:56 +08:00
commit dd7079bc52
4 changed files with 72 additions and 42 deletions

View File

@ -48,7 +48,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.CombatChalleng
return
}
cd, record = this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
Ptype: pb.PlayType_academy,
Ptype: pb.PlayType_combat,
Format: req.Battle,
Mformat: manster.FormatList,
})

View File

@ -17,6 +17,7 @@ func (this *apiComp) DropCheck(session comm.IUserSession, req *pb.CombatDropReq)
func (this *apiComp) Drop(session comm.IUserSession, req *pb.CombatDropReq) (code pb.ErrorCode, data proto.Message) {
var (
info *pb.DBCombatUser
atns []*pb.UserAssets
err error
)
if code = this.DropCheck(session, req); code != pb.ErrorCode_Success {
@ -42,7 +43,14 @@ func (this *apiComp) Drop(session comm.IUserSession, req *pb.CombatDropReq) (cod
}
reward := this.module.configure.GetDropReward(req.Drop)
this.module.DispenseRes(session, reward, true)
session.SendMsg(string(this.module.GetType()), "drop", &pb.CombatDropResp{Code: code})
atns = make([]*pb.UserAssets, len(reward))
for i, v := range reward {
atns[i] = &pb.UserAssets{
A: v.A,
T: v.T,
N: v.N,
}
}
session.SendMsg(string(this.module.GetType()), "drop", &pb.CombatDropResp{Code: code, Atns: atns})
return
}

View File

@ -89,6 +89,7 @@ const (
PlayType_arena PlayType = 7 //竞技场
PlayType_academy PlayType = 8 //联盟学院
PlayType_heroteaching PlayType = 9 //英雄教学
PlayType_combat PlayType = 10 //新关卡
)
// Enum value maps for PlayType.
@ -104,6 +105,7 @@ var (
7: "arena",
8: "academy",
9: "heroteaching",
10: "combat",
}
PlayType_value = map[string]int32{
"null": 0,
@ -116,6 +118,7 @@ var (
"arena": 7,
"academy": 8,
"heroteaching": 9,
"combat": 10,
}
)
@ -647,7 +650,7 @@ var file_battle_battle_db_proto_rawDesc = []byte{
0x39, 0x0a, 0x0a, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a,
0x03, 0x6e, 0x69, 0x6c, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x70, 0x76, 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, 0x2a, 0x8d, 0x01, 0x0a, 0x08, 0x50,
0x03, 0x12, 0x07, 0x0a, 0x03, 0x65, 0x76, 0x65, 0x10, 0x04, 0x2a, 0x99, 0x01, 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,
@ -656,13 +659,14 @@ var file_battle_battle_db_proto_rawDesc = []byte{
0x0f, 0x0a, 0x0b, 0x6d, 0x6f, 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61, 0x73, 0x79, 0x10, 0x06,
0x12, 0x09, 0x0a, 0x05, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x10, 0x07, 0x12, 0x0b, 0x0a, 0x07, 0x61,
0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x10, 0x08, 0x12, 0x10, 0x0a, 0x0c, 0x68, 0x65, 0x72, 0x6f,
0x74, 0x65, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x10, 0x09, 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,
0x74, 0x65, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x10, 0x09, 0x12, 0x0a, 0x0a, 0x06, 0x63, 0x6f,
0x6d, 0x62, 0x61, 0x74, 0x10, 0x0a, 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

@ -395,6 +395,7 @@ type CombatChallengeReceiveResp struct {
unknownFields protoimpl.UnknownFields
Issucc bool `protobuf:"varint,1,opt,name=issucc,proto3" json:"issucc"`
Pass bool `protobuf:"varint,2,opt,name=pass,proto3" json:"pass"` //是否通关
}
func (x *CombatChallengeReceiveResp) Reset() {
@ -436,6 +437,13 @@ func (x *CombatChallengeReceiveResp) GetIssucc() bool {
return false
}
func (x *CombatChallengeReceiveResp) GetPass() bool {
if x != nil {
return x.Pass
}
return false
}
//宝箱获取请求
type CombatDropReq struct {
state protoimpl.MessageState
@ -492,6 +500,7 @@ type CombatDropResp struct {
Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=ErrorCode" json:"code"` //是否成功
Atns []*UserAssets `protobuf:"bytes,2,rep,name=atns,proto3" json:"atns"` //获取物品
Pass bool `protobuf:"varint,3,opt,name=pass,proto3" json:"pass"` //是否通关
}
func (x *CombatDropResp) Reset() {
@ -540,6 +549,13 @@ func (x *CombatDropResp) GetAtns() []*UserAssets {
return nil
}
func (x *CombatDropResp) GetPass() bool {
if x != nil {
return x.Pass
}
return false
}
var File_combat_combat_msg_proto protoreflect.FileDescriptor
var file_combat_combat_msg_proto_rawDesc = []byte{
@ -574,19 +590,21 @@ var file_combat_combat_msg_proto_rawDesc = []byte{
0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6d, 0x61, 0x6e, 0x73, 0x74,
0x65, 0x72, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 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, 0x34, 0x0a, 0x1a, 0x43, 0x6f, 0x6d,
0x74, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x48, 0x0a, 0x1a, 0x43, 0x6f, 0x6d,
0x62, 0x61, 0x74, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 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, 0x22,
0x23, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x44, 0x72, 0x6f, 0x70, 0x52, 0x65, 0x71,
0x12, 0x12, 0x0a, 0x04, 0x64, 0x72, 0x6f, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,
0x64, 0x72, 0x6f, 0x70, 0x22, 0x51, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x44, 0x72,
0x6f, 0x70, 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, 0x1f, 0x0a, 0x04, 0x61, 0x74, 0x6e, 0x73, 0x18, 0x02,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74,
0x73, 0x52, 0x04, 0x61, 0x74, 0x6e, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x12,
0x12, 0x0a, 0x04, 0x70, 0x61, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x70,
0x61, 0x73, 0x73, 0x22, 0x23, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x44, 0x72, 0x6f,
0x70, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x72, 0x6f, 0x70, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x04, 0x64, 0x72, 0x6f, 0x70, 0x22, 0x65, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x62,
0x61, 0x74, 0x44, 0x72, 0x6f, 0x70, 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, 0x1f, 0x0a, 0x04, 0x61, 0x74,
0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41,
0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x04, 0x61, 0x74, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70,
0x61, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x70, 0x61, 0x73, 0x73, 0x42,
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (