上传主线和世界任务 触发升级和英雄招募代码

This commit is contained in:
liwei1dao 2022-12-15 16:37:52 +08:00
parent cd13fbc6bf
commit 9214c2e63e
4 changed files with 83 additions and 22 deletions

View File

@ -25,9 +25,13 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh
mainline *pb.DBMainline // 当前章节信息 mainline *pb.DBMainline // 当前章节信息
res []*cfg.Gameatn // 小章节奖励 res []*cfg.Gameatn // 小章节奖励
isWin bool isWin bool
user *pb.DBUser
hero []string //新的英雄
newhero []string //新的英雄
) )
res = make([]*cfg.Gameatn, 0) res = make([]*cfg.Gameatn, 0)
hero = make([]string, 0)
newhero = make([]string, 0)
code = this.ChallengeOverCheck(session, req) code = this.ChallengeOverCheck(session, req)
if code != pb.ErrorCode_Success { if code != pb.ErrorCode_Success {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
@ -63,7 +67,20 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh
} }
} }
res = append(res, node.Award...) res = append(res, node.Award...)
for _, v := range res {
if v.A == comm.HeroType {
hero = append(hero, v.T)
}
}
if len(hero) > 0 {
ishave := this.module.ModuleUser.CheckTujianHero(session, hero)
for i, v := range ishave {
if v {
newhero = append(newhero, hero[i])
}
}
}
user = this.module.ModuleUser.GetUser(session.GetUserId())
mainline.MainlineId = int32(req.MainlineId) mainline.MainlineId = int32(req.MainlineId)
mainline.BranchID = append(mainline.BranchID, int32(req.MainlineId)) mainline.BranchID = append(mainline.BranchID, int32(req.MainlineId))
update := map[string]interface{}{ update := map[string]interface{}{
@ -95,7 +112,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh
if code = this.module.DispenseRes(session, res, true); code != pb.ErrorCode_Success { if code = this.module.DispenseRes(session, res, true); code != pb.ErrorCode_Success {
this.module.Debugf("DispenseRes err:+%v", res) this.module.Debugf("DispenseRes err:+%v", res)
} }
session.SendMsg(string(this.module.GetType()), MainlineChallengeOverResp, &pb.MainlineChallengeOverResp{Data: mainline}) session.SendMsg(string(this.module.GetType()), MainlineChallengeOverResp, &pb.MainlineChallengeOverResp{Data: mainline, Newheros: newhero, Olv: user.Lv})
return return
} }
} }
@ -122,7 +139,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh
} }
} }
session.SendMsg(string(this.module.GetType()), MainlineChallengeOverResp, &pb.MainlineChallengeOverResp{Data: mainline}) session.SendMsg(string(this.module.GetType()), MainlineChallengeOverResp, &pb.MainlineChallengeOverResp{Data: mainline, Newheros: newhero, Olv: user.Lv})
// 主线任务统计 Rtype60 // 主线任务统计 Rtype60
this.module.ModuleRtask.SendToRtask(session, comm.Rtype60, 1) this.module.ModuleRtask.SendToRtask(session, comm.Rtype60, 1)
this.module.ModuleRtask.SendToRtask(session, comm.Rtype61, int32(req.MainlineId)) this.module.ModuleRtask.SendToRtask(session, comm.Rtype61, int32(req.MainlineId))

View File

@ -19,6 +19,10 @@ func (this *apiComp) BattlefinishCheck(session comm.IUserSession, req *pb.Worldt
} }
func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBattleFinishReq) (code pb.ErrorCode, data proto.Message) { func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBattleFinishReq) (code pb.ErrorCode, data proto.Message) {
var (
user *pb.DBUser
)
if code = this.BattlefinishCheck(session, req); code != pb.ErrorCode_Success { if code = this.BattlefinishCheck(session, req); code != pb.ErrorCode_Success {
return return
} }
@ -36,9 +40,11 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
return return
} }
user = this.module.ModuleUser.GetUser(session.GetUserId())
rsp := &pb.WorldtaskBattleFinishResp{ rsp := &pb.WorldtaskBattleFinishResp{
TaskId: req.TaskId, TaskId: req.TaskId,
Newheros: make([]string, 0),
Olv: user.Lv,
} }
if taskConf.Completetask == 0 { if taskConf.Completetask == 0 {

View File

@ -406,7 +406,9 @@ type MainlineChallengeOverResp struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Data *DBMainline `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` //当前章节信息 Data *DBMainline `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` //当前章节信息
Newheros []string `protobuf:"bytes,2,rep,name=newheros,proto3" json:"newheros"` //获得的新英雄
Olv int32 `protobuf:"varint,3,opt,name=olv,proto3" json:"olv"` //以前的等级
} }
func (x *MainlineChallengeOverResp) Reset() { func (x *MainlineChallengeOverResp) Reset() {
@ -448,6 +450,20 @@ func (x *MainlineChallengeOverResp) GetData() *DBMainline {
return nil return nil
} }
func (x *MainlineChallengeOverResp) GetNewheros() []string {
if x != nil {
return x.Newheros
}
return nil
}
func (x *MainlineChallengeOverResp) GetOlv() int32 {
if x != nil {
return x.Olv
}
return 0
}
// 推送新章节 // 推送新章节
type MainlineNewChapterPush struct { type MainlineNewChapterPush struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -540,16 +556,19 @@ var file_mainline_mainline_msg_proto_rawDesc = []byte{
0x6e, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6d, 0x61, 0x69, 0x6e,
0x6c, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x18, 0x03, 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, 0x3c, 0x0a, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x6a, 0x0a,
0x19, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x19, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e,
0x67, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x04, 0x64, 0x61, 0x67, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x04, 0x64, 0x61,
0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69,
0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x39, 0x0a, 0x16, 0x4d, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x6e,
0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x65, 0x77, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x65, 0x77, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x6e,
0x72, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1f, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x65, 0x77, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x6c, 0x76, 0x18, 0x03,
0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6f, 0x6c, 0x76, 0x22, 0x39, 0x0a, 0x16, 0x4d, 0x61, 0x69,
0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x65, 0x77, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x50,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x75, 0x73, 0x68, 0x12, 0x1f, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x04,
0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -437,7 +437,9 @@ type WorldtaskBattleFinishResp struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId"` //任务ID TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId"` //任务ID
Newheros []string `protobuf:"bytes,2,rep,name=newheros,proto3" json:"newheros"` //获得的新英雄
Olv int32 `protobuf:"varint,3,opt,name=olv,proto3" json:"olv"` //以前的等级
} }
func (x *WorldtaskBattleFinishResp) Reset() { func (x *WorldtaskBattleFinishResp) Reset() {
@ -479,6 +481,20 @@ func (x *WorldtaskBattleFinishResp) GetTaskId() int32 {
return 0 return 0
} }
func (x *WorldtaskBattleFinishResp) GetNewheros() []string {
if x != nil {
return x.Newheros
}
return nil
}
func (x *WorldtaskBattleFinishResp) GetOlv() int32 {
if x != nil {
return x.Olv
}
return 0
}
// 当前完成的任务列表推送 // 当前完成的任务列表推送
type WorldtaskFinishIdsPush struct { type WorldtaskFinishIdsPush struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -571,15 +587,18 @@ var file_worldtask_worldtask_msg_proto_rawDesc = []byte{
0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x70,
0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6f, 0x72, 0x74, 0x18, 0x03, 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, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74,
0x22, 0x33, 0x0a, 0x19, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x42, 0x61, 0x74, 0x22, 0x61, 0x0a, 0x19, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x42, 0x61, 0x74,
0x74, 0x6c, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x74, 0x6c, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a,
0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74,
0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x40, 0x0a, 0x16, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x65, 0x77, 0x68, 0x65, 0x72, 0x6f,
0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x49, 0x64, 0x73, 0x50, 0x75, 0x73, 0x68, 0x12, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x65, 0x77, 0x68, 0x65, 0x72, 0x6f,
0x26, 0x0a, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x6c, 0x76, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03,
0x0b, 0x32, 0x0a, 0x2e, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x08, 0x74, 0x6f, 0x6c, 0x76, 0x22, 0x40, 0x0a, 0x16, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b,
0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x49, 0x64, 0x73, 0x50, 0x75, 0x73, 0x68, 0x12, 0x26, 0x0a,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x0a, 0x2e, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x08, 0x74, 0x61, 0x73,
0x6b, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (