From 3fb906f2291c557fc69cebbef8d8049e47eb33af Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 12 Jan 2024 18:37:09 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/pagoda/api_racechallengeover.go | 57 +++++++++++++++++-------- 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/modules/pagoda/api_racechallengeover.go b/modules/pagoda/api_racechallengeover.go index f8a7f5c66..86964256d 100644 --- a/modules/pagoda/api_racechallengeover.go +++ b/modules/pagoda/api_racechallengeover.go @@ -27,9 +27,11 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda err error atno []*pb.UserAtno // 通关奖励 award []*cfg.Gameatn + res []*cfg.Gameatn changExp map[string]int32 costTime int32 // 耗时 new bool // 是否首次挑战 + fresh bool // 刷新记录 ) changExp = make(map[string]int32, 0) mapData = make(map[string]interface{}, 0) @@ -88,22 +90,6 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda list.Battlecount += 1 mapData["data"] = list.Data mapData["battlecount"] = list.Battlecount - - if new { - if conf.Floors == 1 { // 写数据 - this.module.modelRacePagoda.addCrossPagodaRace(session.GetUserId(), list) - } else { - this.module.modelRacePagoda.ModifyCrossPagodaRaceData(session.GetUserId(), mapData) - } - var score int32 - score = 10000*list.Maxfloor + (10000 - costTime) - // 校验是否刷新记录 - if list.Data[conf.Floors].Consttime > costTime { // 小于之前的时间 入榜 - this.module.modelRacePagoda.SetRacePagodaRankList(score, session.GetUserId()) - } - award = append(award, conf.KeyReward...) // 首通奖励 - } - if err = this.module.modelRacePagoda.ModifyPagodaRaceData(session.GetUserId(), mapData); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_DBError, @@ -111,6 +97,42 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda Message: err.Error(), } } + if list.Data[conf.Floors].Consttime > costTime { + list.Data[conf.Floors].Consttime = costTime + fresh = true + } + var score int32 + score = 10000*list.Maxfloor + (10000 - costTime) + szLine := make([]*pb.LineUp, 0) + var Leadpos int32 + if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 { + Leadpos = req.Report.Info.Redflist[0].Leadpos + for _, v := range req.Report.Info.Redflist[0].Team { + if v != nil { + szLine = append(szLine, &pb.LineUp{ + Cid: v.HeroID, + Star: v.Star, + Lv: v.Lv, + }) + } + } + } + list.Data[conf.Floors].Line = &pb.LineData{ + Leadpos: Leadpos, + Line: szLine, + } + if new { + if conf.Floors == 1 { // 写数据 + this.module.modelRacePagoda.addCrossPagodaRace(session.GetUserId(), list) + } + res = append(res, conf.KeyReward...) // 首通奖励 + } + // 校验是否刷新记录 + if fresh || new { + this.module.modelRacePagoda.SetRacePagodaRankList(score, session.GetUserId()) + mapData["data"] = list.Data + this.module.modelRacePagoda.ModifyCrossPagodaRaceData(session.GetUserId(), mapData) + } if conf.Exp > 0 { var heroObjs []string @@ -124,8 +146,9 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda if changExp, award, errdata = this.module.ModuleHero.AddHerosExp(session, heroObjs, conf.Exp); errdata != nil { return } + res = append(res, award...) } - award = append(award, conf.Reward...) + res = append(res, conf.Reward...) // 通关奖励 if errdata, atno = this.module.DispenseAtno(session, award, true); errdata != nil { return From 52bb96c96dff1f0e688f30ec6571986e54363acb Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 12 Jan 2024 18:46:27 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E4=BF=9D=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/pagoda/api_racechallengeover.go | 7 ++++ pb/pagoda_db.pb.go | 47 +++++++++++++++---------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/modules/pagoda/api_racechallengeover.go b/modules/pagoda/api_racechallengeover.go index 86964256d..05e8fc943 100644 --- a/modules/pagoda/api_racechallengeover.go +++ b/modules/pagoda/api_racechallengeover.go @@ -131,6 +131,13 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda if fresh || new { this.module.modelRacePagoda.SetRacePagodaRankList(score, session.GetUserId()) mapData["data"] = list.Data + user, err := this.module.ModuleUser.GetUser(session.GetUserId()) + if err == nil { + list.Uinfo = comm.GetUserBaseInfo(user) + } + list.Uinfo = comm.GetUserBaseInfo(user) + mapData["uinfo"] = list.Uinfo + this.module.modelRacePagoda.ModifyCrossPagodaRaceData(session.GetUserId(), mapData) } diff --git a/pb/pagoda_db.pb.go b/pb/pagoda_db.pb.go index 1fff23f44..f3f25293e 100644 --- a/pb/pagoda_db.pb.go +++ b/pb/pagoda_db.pb.go @@ -470,6 +470,7 @@ type DBPagodaRace struct { Rtime int64 `protobuf:"varint,5,opt,name=rtime,proto3" json:"rtime"` // 刷新时间 客户端不用 Battlecount int32 `protobuf:"varint,6,opt,name=battlecount,proto3" json:"battlecount"` // 今日挑战次数 Reward map[int32]int32 `protobuf:"bytes,7,rep,name=reward,proto3" json:"reward" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key 组 + Uinfo *BaseUserInfo `protobuf:"bytes,8,opt,name=uinfo,proto3" json:"uinfo"` //用户基础 } func (x *DBPagodaRace) Reset() { @@ -553,6 +554,13 @@ func (x *DBPagodaRace) GetReward() map[int32]int32 { return nil } +func (x *DBPagodaRace) GetUinfo() *BaseUserInfo { + if x != nil { + return x.Uinfo + } + return nil +} + var File_pagoda_pagoda_db_proto protoreflect.FileDescriptor var file_pagoda_pagoda_db_proto_rawDesc = []byte{ @@ -626,7 +634,7 @@ var file_pagoda_pagoda_db_proto_rawDesc = []byte{ 0x0a, 0x04, 0x73, 0x74, 0x61, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x74, 0x61, 0x72, 0x12, 0x1d, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x4c, 0x69, 0x6e, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x6c, 0x69, 0x6e, - 0x65, 0x22, 0xe3, 0x02, 0x0a, 0x0c, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61, + 0x65, 0x22, 0x88, 0x03, 0x0a, 0x0c, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x2b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, @@ -640,16 +648,18 @@ var file_pagoda_pagoda_db_proto_rawDesc = []byte{ 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x31, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x1a, 0x42, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x52, 0x61, 0x63, 0x65, 0x44, 0x61, 0x74, - 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, - 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x23, 0x0a, 0x05, 0x75, 0x69, 0x6e, 0x66, + 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, + 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x75, 0x69, 0x6e, 0x66, 0x6f, 0x1a, 0x42, 0x0a, + 0x09, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x52, 0x61, + 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, + 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -692,13 +702,14 @@ var file_pagoda_pagoda_db_proto_depIdxs = []int32{ 13, // 7: RaceData.line:type_name -> LineData 9, // 8: DBPagodaRace.data:type_name -> DBPagodaRace.DataEntry 10, // 9: DBPagodaRace.reward:type_name -> DBPagodaRace.RewardEntry - 4, // 10: DBRacePagodaRecord.DataEntry.value:type_name -> RaceData - 4, // 11: DBPagodaRace.DataEntry.value:type_name -> RaceData - 12, // [12:12] is the sub-list for method output_type - 12, // [12:12] is the sub-list for method input_type - 12, // [12:12] is the sub-list for extension type_name - 12, // [12:12] is the sub-list for extension extendee - 0, // [0:12] is the sub-list for field type_name + 12, // 10: DBPagodaRace.uinfo:type_name -> BaseUserInfo + 4, // 11: DBRacePagodaRecord.DataEntry.value:type_name -> RaceData + 4, // 12: DBPagodaRace.DataEntry.value:type_name -> RaceData + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name } func init() { file_pagoda_pagoda_db_proto_init() } From bbb070dd2c36f39f6db29bf7eb99dd972a0bc795 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 12 Jan 2024 20:03:49 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=85=AD=E5=90=88=E5=A1=94=E6=88=98?= =?UTF-8?q?=E6=96=97=E5=A5=96=E5=8A=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/pagoda/api_racechallengeover.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/pagoda/api_racechallengeover.go b/modules/pagoda/api_racechallengeover.go index 05e8fc943..e7148c3ca 100644 --- a/modules/pagoda/api_racechallengeover.go +++ b/modules/pagoda/api_racechallengeover.go @@ -157,7 +157,7 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda } res = append(res, conf.Reward...) // 通关奖励 - if errdata, atno = this.module.DispenseAtno(session, award, true); errdata != nil { + if errdata, atno = this.module.DispenseAtno(session, res, true); errdata != nil { return } session.SendMsg(string(this.module.GetType()), PagodaChallengeRaceOverResp, &pb.PagodaChallengeRaceOverResp{