diff --git a/cmd/robot/task.go b/cmd/robot/task.go index 3c9269dea..6cfaa7816 100644 --- a/cmd/robot/task.go +++ b/cmd/robot/task.go @@ -40,7 +40,7 @@ var ( subType: task.TaskSubTypeReceive, req: &pb.TaskReceiveReq{ TaskTag: int32(comm.TASK_ACHIEVE), - Id: "62e778167cc92ac48c4b249b", + Id: 1, }, rsp: &pb.TaskReceiveResp{}, enabled: true, @@ -71,20 +71,11 @@ var ( mainType: string(comm.ModuleTask), subType: task.TaskSubTypeActiveReceive, req: &pb.TaskActiveReceiveReq{ - Id: "62d90fcd974bb2fd638a3dc5", + Id: 1, TaskTag: int32(comm.TASK_DAILY), }, rsp: &pb.TaskActiveReceiveResp{}, // enabled: true, - }, { - desc: "卡牌攻略", - mainType: string(comm.ModuleTask), - subType: task.TaskSubTypeStrategy, - req: &pb.TaskDoStrategyReq{ - HeroCfgId: 13001, - }, - rsp: &pb.TaskDoStrategyResp{}, - // enabled: true, }, } ) diff --git a/modules/enchant/api_buy.go b/modules/enchant/api_buy.go index 5f00a207b..f7d956e63 100644 --- a/modules/enchant/api_buy.go +++ b/modules/enchant/api_buy.go @@ -88,8 +88,8 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.EnchantBuyReq) (code list.RecoveryTime = 0 } addCount += req.Count - if amount+addCount > conf.VikingNum { - code = pb.ErrorCode_VikingBuyMaxCount + if amount+addCount > conf.EnchantbossMax { + code = pb.ErrorCode_EnchantBuyMaxCount return } mapData["recoveryTime"] = list.RecoveryTime diff --git a/modules/enchant/api_challenge.go b/modules/enchant/api_challenge.go index 1b5476809..2e29dd6f4 100644 --- a/modules/enchant/api_challenge.go +++ b/modules/enchant/api_challenge.go @@ -56,7 +56,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.EnchantChallen } code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{ - Ptype: pb.PlayType_hunting, + Ptype: pb.PlayType_enchant, Title: "", Format: &pb.BattleFormation{ Leadpos: req.Leadpos, diff --git a/modules/enchant/api_challengeover.go b/modules/enchant/api_challengeover.go index 58e4bcf28..3bafdab5b 100644 --- a/modules/enchant/api_challengeover.go +++ b/modules/enchant/api_challengeover.go @@ -3,6 +3,7 @@ package enchant import ( "go_dreamfactory/comm" "go_dreamfactory/pb" + "go_dreamfactory/sys/configure" cfg "go_dreamfactory/sys/configure/structs" "google.golang.org/protobuf/proto" @@ -21,7 +22,8 @@ func (this *apiComp) ChallengeOverCheck(session comm.IUserSession, req *pb.Encha func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantChallengeOverReq) (code pb.ErrorCode, data proto.Message) { var ( mapData map[string]interface{} - bWin bool // 战斗是否胜利 + bWin bool // 战斗是否胜利 + score int32 // 通关获得分数 ) mapData = make(map[string]interface{}, 0) // reward = make([]*cfg.Gameatn, 0) @@ -67,30 +69,28 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha return } - //amount := int32(this.module.ModuleItems.QueryItemAmount(session.GetUserId(), costRes.T)) // 获取当前数量 + amount := int32(this.module.ModuleItems.QueryItemAmount(session.GetUserId(), costRes.T)) // 获取当前数量 - // if amount < conf.EnchantNum { - // enchant.RecoveryTime = configure.Now().Unix() - // mapData["recoveryTime"] = enchant.RecoveryTime - // } - if bWin { - this.module.CheckRank(session.GetUserId(), req.BossType, enchant, req.Report, 0) + if amount < conf.EnchantbossMax { // 挑战卷 小于副本最大存储数的时候开始恢复 + enchant.RecoveryTime = configure.Now().Unix() + mapData["recoveryTime"] = enchant.RecoveryTime } - // 耗时校验 当前战斗胜利时间消耗小于之前刷新数据 - + if bWin { + this.module.CheckRank(session.GetUserId(), req.BossType, enchant, req.Report, req.Score) + } + enchant.Boss[req.BossType] = req.Score // 获得的积分 // 发放通关随机奖励 - // reward = this.module.configure.GetDropReward(cfgEnchant.) // 获取掉落奖励 - // if code = this.module.DispenseRes(session, reward, true); code != pb.ErrorCode_Success { - // return - // } - // if newChallenge && bWin { // 新关卡挑战通过 发放首通奖励 - // if code = this.module.DispenseRes(session, cfgEnchant.Firstprize, true); code != pb.ErrorCode_Success { - // return - // } - // enchant.Boss[req.BossType] += 1 - // mapData["boss"] = enchant.Boss + for _, v := range cfgEnchant { + if score >= v.ScoreLow && score <= v.ScoreUp { + for _, v1 := range v.RewardDrop { + reward := this.module.configure.GetDropReward(v1) // 获取掉落奖励 + if code = this.module.DispenseRes(session, reward, true); code != pb.ErrorCode_Success { + return + } + } + } + } - // } mapData["challengeTime"] = enchant.BossTime mapData["boss"] = enchant.Boss code = this.module.ModifyEnchantData(session.GetUserId(), mapData) diff --git a/modules/enchant/model_enchant.go b/modules/enchant/model_enchant.go index 78b582f14..fd90439a3 100644 --- a/modules/enchant/model_enchant.go +++ b/modules/enchant/model_enchant.go @@ -37,7 +37,7 @@ func (this *modelEnchant) getEnchantList(uid string) (result *pb.DBEnchant, err result = &pb.DBEnchant{ Id: primitive.NewObjectID().Hex(), Uid: uid, - Boss: make(map[int32]int32), + Boss: make(map[int32]int64), BossTime: make(map[int32]int32), } if err = this.Get(uid, result); err != nil && mgo.MongodbNil != err { diff --git a/modules/enchant/model_rank.go b/modules/enchant/model_rank.go index 463c0abd1..2d8f8353c 100644 --- a/modules/enchant/model_rank.go +++ b/modules/enchant/model_rank.go @@ -56,7 +56,7 @@ func (this *ModelRank) getEnchantRankListByBossType(uid string, bossType int32) } // 排行数据写跨服 -func (this *ModelRank) SetRankListData(tableName string, score int32, uid string) { +func (this *ModelRank) SetRankListData(tableName string, score int64, uid string) { if !db.IsCross() { if conn, err := db.Cross(); err == nil { var ( diff --git a/modules/enchant/module.go b/modules/enchant/module.go index 0f0b58a8a..f6119d912 100644 --- a/modules/enchant/module.go +++ b/modules/enchant/module.go @@ -76,12 +76,12 @@ func (this *Enchant) CheckUserBaseEnchantInfo(uid string) (data []*pb.DBEnchantR } return } -func (this *Enchant) CheckRank(uid string, boosID int32, Enchant *pb.DBEnchant, report *pb.BattleReport, score int32) { +func (this *Enchant) CheckRank(uid string, boosID int32, Enchant *pb.DBEnchant, report *pb.BattleReport, score int64) { costTime := report.Costtime if Enchant.BossTime[boosID] > costTime || Enchant.BossTime[boosID] == 0 { // 刷新记录 Enchant.BossTime[boosID] = costTime - szLine := make([]*pb.LineUp, 5) + szLine := make([]*pb.LineUp, 0) Leadpos := 0 if report != nil && report.Info != nil && len(report.Info.Redflist) > 0 { costTime = report.Costtime @@ -108,6 +108,7 @@ func (this *Enchant) CheckRank(uid string, boosID int32, Enchant *pb.DBEnchant, mapRankData["Leadpos"] = Leadpos mapRankData["line"] = szLine mapRankData["costTime"] = costTime + mapRankData["score"] = score conn_, _ := db.Cross() dbModel := db.NewDBModel(comm.TableEnchantRank, time.Hour, conn_) dbModel.ChangeList(uid, v.Id, mapRankData) @@ -127,6 +128,7 @@ func (this *Enchant) CheckRank(uid string, boosID int32, Enchant *pb.DBEnchant, Leadpos: int32(Leadpos), Line: szLine, CostTime: costTime, + Score: score, } objID = new.Id conn_, _ := db.Cross() diff --git a/modules/gourmet/api_getlist.go b/modules/gourmet/api_getlist.go index 689bd9416..3b2d90080 100644 --- a/modules/gourmet/api_getlist.go +++ b/modules/gourmet/api_getlist.go @@ -32,11 +32,6 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.GourmetGetListRe // 任务统计 this.module.ModuleRtask.SendToRtask(session, comm.Rtype136, _gourmet.TotalTime) - resp := &pb.GourmetCreateOrderReq{} - resp.Order = append(resp.Order, &pb.OrderCook{ - FoodType: 1001, - FoodCount: 10, - }) - this.CreateOrder(session, resp) + return } diff --git a/modules/rtask/updateHandle.go b/modules/rtask/updateHandle.go index 1a2c40884..8a6aa4cd0 100644 --- a/modules/rtask/updateHandle.go +++ b/modules/rtask/updateHandle.go @@ -63,13 +63,8 @@ func (this *ModelRtaskRecord) overrideUpdate(uid string, cfg *cfg.GameRdtaskCond return } } - log.Debug("覆盖数值更新", - log.Field{Key: "uid", Value: uid}, - log.Field{Key: "condiId", Value: cfg.Id}, - log.Field{Key: "params", Value: vals}, - log.Field{Key: "updated", Value: record.Vals[cfg.Id]}, - ) - this.listenTask(uid, cfg.Id) + // log.Debug("覆盖数值更新", log.Fields{"uid": uid, "condiId": cfg.Id, "params": vals, "updated": record.Vals[cfg.Id]}) + // this.listenTask(uid, cfg.Id) return } @@ -94,7 +89,7 @@ func (this *ModelRtaskRecord) addUpdate(uid string, cfg *cfg.GameRdtaskCondiData //查找任务数据 if v, ok := record.Vals[cfg.Id]; ok { newArr := make([]int32, len(vals)) - newArr = vals + copy(newArr, vals) srcCount := v.Data[0] newArr[0] = srcCount + vals[0] v.Data = toMap(newArr...) @@ -122,7 +117,7 @@ func (this *ModelRtaskRecord) addUpdate(uid string, cfg *cfg.GameRdtaskCondiData log.Field{Key: "updated", Value: record.Vals[cfg.Id]}, ) - this.listenTask(uid, cfg.Id) + // this.listenTask(uid, cfg.Id) return } diff --git a/modules/task/api_activereceive.go b/modules/task/api_activereceive.go index 320fc19ed..16f0bb31b 100644 --- a/modules/task/api_activereceive.go +++ b/modules/task/api_activereceive.go @@ -36,49 +36,48 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive return } var rewards []*cfg.Gameatn + var flag bool + update := map[string]interface{}{} // 玩家的 - activeList := this.moduleTask.modelTaskActive.getActiveListByTag(uid, comm.TaskTag(req.TaskTag)) - var activityData *pb.ActivityData + activeList := this.moduleTask.modelTaskActive.getActiveList(uid) + // var activityData *pb.ActivityData for _, v := range activeList { if v.TaskId == req.Id { - activityData = v + if v.Received != 1 { + conf := this.moduleTask.configure.getTaskActiveById(v.TaskId) + if conf == nil { + code = pb.ErrorCode_ConfigNoFound + return + } + + if req.TaskTag == int32(comm.TASK_DAILY) { + if ue.Activeday < conf.Active { + code = pb.ErrorCode_TaskActiveNoenough + return + } + } else if req.TaskTag == int32(comm.TASK_WEEKLY) { + if ue.Activeweek < conf.Active { + code = pb.ErrorCode_TaskActiveNoenough + return + } + } + + v.Received = 1 + flag = true + rewards = append(rewards, conf.Reword...) + } break } } - if activityData == nil { - code = pb.ErrorCode_TaskNotFound - return - } + if flag { + update["activityList"] = activeList - if activityData.Received != 1 { //未领取 - conf := this.moduleTask.configure.getTaskActiveById(activityData.TaskId) - if conf == nil { - code = pb.ErrorCode_ConfigNoFound + if err := this.moduleTask.modelTaskActive.Change(session.GetUserId(), update); err != nil { + this.moduleTask.Errorf("updateReceive err %v", err) + code = pb.ErrorCode_DBError return } - - update := make(map[string]interface{}) - if req.TaskTag == int32(comm.TASK_DAILY) { - if ue.Activeday < conf.Active { - code = pb.ErrorCode_TaskActiveNoenough - return - } - } else if req.TaskTag == int32(comm.TASK_WEEKLY) { - if ue.Activeweek < conf.Active { - code = pb.ErrorCode_TaskActiveNoenough - return - } - } - update["received"] = 1 - if len(update) > 0 { - if err := this.moduleTask.modelTaskActive.updateReceive(session.GetUserId(), update); err != nil { - this.moduleTask.Errorf("updateReceive err %v", err) - code = pb.ErrorCode_DBError - return - } - } - rewards = append(rewards, conf.Reword...) } if len(rewards) > 0 { diff --git a/modules/task/api_receive.go b/modules/task/api_receive.go index 1d3671c2b..bcb1abd54 100644 --- a/modules/task/api_receive.go +++ b/modules/task/api_receive.go @@ -108,10 +108,23 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq) } //更新用户领取状态 - update := map[string]interface{}{ - "received": 1, + for _, v := range taskDataList { + if v.TaskId == req.Id { + v.Received = 1 + break + } } - if err := this.moduleTask.modelTask.modifyUserTask(session.GetUserId(), taskData.TaskId, update); err != nil { + update := map[string]interface{}{} + switch req.TaskTag { + case int32(comm.TASK_DAILY): + update["dayList"] = taskDataList + case int32(comm.TASK_WEEKLY): + update["weekList"] = taskDataList + case int32(comm.TASK_ACHIEVE): + update["achieveList"] = taskDataList + } + + if err := this.moduleTask.modelTask.Change(session.GetUserId(), update); err != nil { code = pb.ErrorCode_DBError return } diff --git a/modules/task/model_active.go b/modules/task/model_active.go index 9fb0f1dea..2b11bb3fe 100644 --- a/modules/task/model_active.go +++ b/modules/task/model_active.go @@ -62,6 +62,16 @@ func (this *ModelTaskActive) initActiveReward(uid string, taskTag comm.TaskTag) } } +func (this *ModelTaskActive) getActiveList(uid string) (list []*pb.ActivityData) { + task := &pb.DBActivity{} + if err := this.Get(uid, task); err != nil { + this.moduleTask.Errorf("getTaskList err %v", err) + return + } + + return task.ActivityList +} + //获取玩家活跃度列表 func (this *ModelTaskActive) getActiveListByTag(uid string, taskTag comm.TaskTag) (list []*pb.ActivityData) { task := &pb.DBActivity{} diff --git a/modules/task/model_task.go b/modules/task/model_task.go index 1796b66db..a42bd5de7 100644 --- a/modules/task/model_task.go +++ b/modules/task/model_task.go @@ -82,6 +82,7 @@ func (this *ModelTask) getTaskListByTag(uid string, taskTag comm.TaskTag) *pb.DB return nil } + update := map[string]interface{}{} var dataList []*pb.TaskData if taskTag == comm.TASK_DAILY { dataList = task.DayList @@ -90,7 +91,6 @@ func (this *ModelTask) getTaskListByTag(uid string, taskTag comm.TaskTag) *pb.DB } // 筛选出指定tag的任务 - update := map[string]interface{}{} var flag bool for _, v := range dataList { oldVal := v.Progress @@ -112,9 +112,14 @@ func (this *ModelTask) getTaskListByTag(uid string, taskTag comm.TaskTag) *pb.DB } } if flag { - update["dayList"] = task.DayList - if err := this.moduleTask.modelTask.Change("uid", update); err != nil { - log.Error("更新每日任务", log.Field{Key: "uid", Value: uid}) + if taskTag == comm.TASK_DAILY { + update["dayList"] = dataList + } else if taskTag == comm.TASK_WEEKLY { + update["weekList"] = dataList + } + + if err := this.moduleTask.modelTask.Change(uid, update); err != nil { + this.moduleTask.Error("change err", log.Field{Key: "uid", Value: uid}) } } @@ -142,6 +147,7 @@ func (this *ModelTask) getTaskListByTag(uid string, taskTag comm.TaskTag) *pb.DB // 成就列表 var achieveList []*pb.TaskData + var bflag bool if taskTag == comm.TASK_ACHIEVE { for _, v := range task.AchieveList { if curTask := this.moduleTask.configure.getTaskById(v.TaskId); curTask != nil { @@ -165,6 +171,32 @@ func (this *ModelTask) getTaskListByTag(uid string, taskTag comm.TaskTag) *pb.DB } } } + + for _, v := range achieveList { + oldVal := v.Progress + var newVal int32 + if p, ok := dr.Vals[v.TypeId]; ok { + if len(p.Data) == 0 { + continue + } + newVal = p.Data[0] + if code := this.moduleTask.ModuleRtask.CheckCondi(uid, v.TypeId); code == pb.ErrorCode_Success { + v.Progress = p.Data[0] + v.Status = 1 + } else { + v.Progress = p.Data[0] + } + } + if oldVal != newVal { + bflag = true + } + } + if bflag { + update["achieveList"] = achieveList + if err := this.moduleTask.modelTask.Change(uid, update); err != nil { + log.Error("err", log.Field{Key: "uid", Value: uid}) + } + } task.AchieveList = achieveList } @@ -325,6 +357,7 @@ func (this *ModelTask) checkTask(uid string, taskId int32) (*pb.TaskData, bool) } //更改用户任务 +// Deprecated func (this *ModelTask) modifyUserTask(uid string, taskId int32, data map[string]interface{}) error { var task *pb.DBTask if err := this.GetList(uid, &task); err != nil { diff --git a/pb/battle_db.pb.go b/pb/battle_db.pb.go index 71ae306ca..2b7a6f648 100644 --- a/pb/battle_db.pb.go +++ b/pb/battle_db.pb.go @@ -90,6 +90,7 @@ const ( PlayType_academy PlayType = 8 //联盟学院 PlayType_heroteaching PlayType = 9 //英雄教学 PlayType_combat PlayType = 10 //新关卡 + PlayType_enchant PlayType = 11 // 附魔副本 ) // Enum value maps for PlayType. @@ -106,6 +107,7 @@ var ( 8: "academy", 9: "heroteaching", 10: "combat", + 11: "enchant", } PlayType_value = map[string]int32{ "null": 0, @@ -119,6 +121,7 @@ var ( "academy": 8, "heroteaching": 9, "combat": 10, + "enchant": 11, } ) @@ -672,7 +675,7 @@ var file_battle_battle_db_proto_rawDesc = []byte{ 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, - 0x99, 0x01, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, + 0xa6, 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, 0x74, 0x61, 0x73, 0x6b, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x68, @@ -681,13 +684,14 @@ var file_battle_battle_db_proto_rawDesc = []byte{ 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, 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, + 0x0a, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x10, 0x0a, 0x12, 0x0b, 0x0a, 0x07, 0x65, + 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x10, 0x0b, 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 ( diff --git a/pb/enchant_db.pb.go b/pb/enchant_db.pb.go index 5194be760..b5d0a89f5 100644 --- a/pb/enchant_db.pb.go +++ b/pb/enchant_db.pb.go @@ -27,7 +27,7 @@ type DBEnchant struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID - Boss map[int32]int32 `protobuf:"bytes,3,rep,name=boss,proto3" json:"boss" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key boss 类型 value 积分 + Boss map[int32]int64 `protobuf:"bytes,3,rep,name=boss,proto3" json:"boss" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key boss 类型 value 积分 BuyCount int32 `protobuf:"varint,4,opt,name=buyCount,proto3" json:"buyCount" bson:"buyCount"` //购买次数 CTime int64 `protobuf:"varint,5,opt,name=cTime,proto3" json:"cTime" bson:"cTime"` //修改时间 BossTime map[int32]int32 `protobuf:"bytes,6,rep,name=bossTime,proto3" json:"bossTime" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"bossTime"` // @@ -80,7 +80,7 @@ func (x *DBEnchant) GetUid() string { return "" } -func (x *DBEnchant) GetBoss() map[int32]int32 { +func (x *DBEnchant) GetBoss() map[int32]int64 { if x != nil { return x.Boss } @@ -129,6 +129,7 @@ type DBEnchantRank struct { Leadpos int32 `protobuf:"varint,6,opt,name=leadpos,proto3" json:"leadpos"` //队长位置 Line []*LineUp `protobuf:"bytes,7,rep,name=line,proto3" json:"line"` // 阵容数据 CostTime int32 `protobuf:"varint,8,opt,name=costTime,proto3" json:"costTime" bson:"costTime"` //闯关耗时 单位s + Score int64 `protobuf:"varint,9,opt,name=score,proto3" json:"score" bson:"score"` } func (x *DBEnchantRank) Reset() { @@ -219,6 +220,13 @@ func (x *DBEnchantRank) GetCostTime() int32 { return 0 } +func (x *DBEnchantRank) GetScore() int64 { + if x != nil { + return x.Score + } + return 0 +} + var File_enchant_enchant_db_proto protoreflect.FileDescriptor var file_enchant_enchant_db_proto_rawDesc = []byte{ @@ -242,12 +250,12 @@ var file_enchant_enchant_db_proto_rawDesc = []byte{ 0x6f, 0x76, 0x65, 0x72, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x1a, 0x37, 0x0a, 0x09, 0x42, 0x6f, 0x73, 0x73, 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, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x42, 0x6f, 0x73, 0x73, 0x54, 0x69, 0x6d, 0x65, 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, 0x22, - 0xcc, 0x01, 0x0a, 0x0d, 0x44, 0x42, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x52, 0x61, 0x6e, + 0xe2, 0x01, 0x0a, 0x0d, 0x44, 0x42, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x52, 0x61, 0x6e, 0x6b, 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, 0x1a, 0x0a, 0x08, 0x62, 0x6f, 0x73, 0x73, 0x74, 0x79, 0x70, 0x65, 0x18, @@ -259,8 +267,10 @@ var file_enchant_enchant_db_proto_rawDesc = []byte{ 0x61, 0x64, 0x70, 0x6f, 0x73, 0x12, 0x1b, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x4c, 0x69, 0x6e, 0x65, 0x55, 0x70, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x6f, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x42, 0x06, - 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x6f, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, + 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, + 0x63, 0x6f, 0x72, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pb/enchant_msg.pb.go b/pb/enchant_msg.pb.go index 5a81ce4df..4284242b0 100644 --- a/pb/enchant_msg.pb.go +++ b/pb/enchant_msg.pb.go @@ -231,6 +231,7 @@ type EnchantChallengeOverReq struct { BossType int32 `protobuf:"varint,1,opt,name=bossType,proto3" json:"bossType"` // boos 类型 Report *BattleReport `protobuf:"bytes,2,opt,name=report,proto3" json:"report"` //战报 + Score int64 `protobuf:"varint,3,opt,name=score,proto3" json:"score"` //获得积分 或伤害 } func (x *EnchantChallengeOverReq) Reset() { @@ -279,6 +280,13 @@ func (x *EnchantChallengeOverReq) GetReport() *BattleReport { return nil } +func (x *EnchantChallengeOverReq) GetScore() int64 { + if x != nil { + return x.Score + } + return 0 +} + // 客户端通知服务器打赢了 type EnchantChallengeOverResp struct { state protoimpl.MessageState @@ -549,31 +557,33 @@ var file_enchant_enchant_msg_proto_rawDesc = []byte{ 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x6f, 0x73, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x62, 0x6f, 0x73, - 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, 0x5c, 0x0a, 0x17, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, + 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, 0x72, 0x0a, 0x17, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x6f, 0x73, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x62, 0x6f, 0x73, 0x73, 0x54, 0x79, 0x70, 0x65, 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, 0x3a, 0x0a, 0x18, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x43, 0x68, - 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, - 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, - 0x44, 0x42, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, - 0x25, 0x0a, 0x0d, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x42, 0x75, 0x79, 0x52, 0x65, 0x71, - 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x30, 0x0a, 0x0e, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e, - 0x74, 0x42, 0x75, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x45, 0x6e, 0x63, 0x68, 0x61, - 0x6e, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x48, 0x0a, 0x12, 0x45, 0x6e, 0x63, 0x68, - 0x61, 0x6e, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1a, - 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x08, 0x62, 0x6f, 0x6f, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x72, - 0x69, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x72, 0x69, 0x65, - 0x6e, 0x64, 0x22, 0x3b, 0x0a, 0x13, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x52, 0x61, 0x6e, - 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x05, 0x72, 0x61, 0x6e, - 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x42, 0x45, 0x6e, 0x63, - 0x68, 0x61, 0x6e, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x6b, 0x73, 0x42, - 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x72, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x3a, 0x0a, 0x18, 0x45, 0x6e, 0x63, + 0x68, 0x61, 0x6e, 0x74, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x4f, 0x76, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x25, 0x0a, 0x0d, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, + 0x42, 0x75, 0x79, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x30, 0x0a, 0x0e, + 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x42, 0x75, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, + 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, + 0x42, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x48, + 0x0a, 0x12, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x4c, 0x69, 0x73, + 0x74, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x73, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x62, 0x6f, 0x6f, 0x73, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x06, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x22, 0x3b, 0x0a, 0x13, 0x45, 0x6e, 0x63, 0x68, + 0x61, 0x6e, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x24, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, + 0x2e, 0x44, 0x42, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x05, + 0x72, 0x61, 0x6e, 0x6b, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var (