From d4e24838f9fdbdb9bc599fa7e3156281d59efad1 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 18 Nov 2022 18:53:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BD=E5=8D=A1=20+=20=E7=8B=A9=E7=8C=8E?= =?UTF-8?q?=E6=8C=91=E6=88=98=E6=AC=A1=E6=95=B0=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 5 ++ modules/hero/api_drawCard.go | 62 ++++++++------- modules/hero/module.go | 111 +++++++++++++++++++++++++++ modules/hunting/api_buy.go | 42 ++++++++-- modules/hunting/api_challengeover.go | 29 +++---- modules/hunting/api_getlist.go | 33 +++++--- modules/hunting/comp_configure.go | 11 +++ modules/hunting/model_hunting.go | 7 +- modules/viking/api_buy.go | 5 -- pb/hero_db.pb.go | 95 ++++++++++++++++++----- pb/hunting_db.pb.go | 74 +++++++++++------- 11 files changed, 361 insertions(+), 113 deletions(-) diff --git a/comm/imodule.go b/comm/imodule.go index 9fa563ae3..0d8e40e97 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -63,6 +63,11 @@ type ( GetHeroListByUse(uid string) []*pb.DBHero // 非初始状态的英雄列表 // 推送属性变化 PushHeroProperty(session IUserSession, heros []*pb.DBHero) (err error) + + // 充值了多少钱 + RechargeMoney(uid string, money int32) + // 多少天没登录 + NoLoginDay(uid string, day int32) } //玩家 diff --git a/modules/hero/api_drawCard.go b/modules/hero/api_drawCard.go index 040053c54..193edd31d 100644 --- a/modules/hero/api_drawCard.go +++ b/modules/hero/api_drawCard.go @@ -18,12 +18,12 @@ func (this *apiComp) DrawCardCheck(session comm.IUserSession, req *pb.HeroDrawCa //抽卡 func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq) (code pb.ErrorCode, data proto.Message) { var ( - szCards []string // 最终抽到的卡牌 - drawCount int32 // 抽卡次数 - szStar []int32 //星级 - costRes []*cfg.Gameatn - star4Max int32 // 10连抽最大4星数量 - star5Max int32 // 10连抽最大5星数量 + szCards []string // 最终抽到的卡牌 + drawCount int32 // 抽卡次数 + szStar []int32 //星级 + costRes []*cfg.Gameatn // 消耗 + star4Max int32 // 10连抽最大4星数量 + star5Max int32 // 10连抽最大5星数量 cfgDraw *cfg.GameGlobalData costAtn *cfg.Gameatn heroRecord *pb.DBHeroRecord @@ -42,7 +42,6 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq } szCards = make([]string, 0) rsp := &pb.HeroDrawCardResp{} - cfg := cfgDraw heroRecord, _ = this.module.modelRecord.GetHeroRecord(session.GetUserId()) drawCount = heroRecord.Drawcount @@ -61,10 +60,14 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq } for i := 0; i < int(req.DrawCount); i++ { - pool = this.module.modelHero.CheckPool(drawCount, cfg) + pool = this.module.modelHero.CheckPool(drawCount, cfgDraw) drawCount += 1 strPool = append(strPool, pool) - + ret := this.CheckCondition(session.GetUserId(), req.DrawCount) + if ret == true { // 命中插入5星英雄 + szStar = append(szStar, 5) + continue + } sz := make([]int32, 0) if cfgDraw.BasePoolStar3 != 0 { sz = append(sz, cfgDraw.BasePoolStar3) @@ -76,8 +79,8 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq sz = append(sz, cfgDraw.BasePoolStar5) } starIndex := this.module.modelHero.GetRandW(sz) - heroRecord.Star4++ - heroRecord.Star5++ + heroRecord.Star4++ // 4星保底数量+1 + heroRecord.Star5++ // 5星保底数量+1 if starIndex == 1 { heroRecord.Star4 = 0 star4Max++ @@ -85,19 +88,20 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq star5Max++ heroRecord.Star5 = 0 } - if star4Max >= cfgDraw.Draw10Star4Max || star5Max >= cfgDraw.Draw10Star5Max { + if star4Max >= cfgDraw.Draw10Star4Max || star5Max >= cfgDraw.Draw10Star5Max { // 达到10连抽最大(4,5星)数量 直接给三星 starIndex = 0 + } else { + // 普通卡池保底 + if cfgDraw.DrawFloorStar4 <= heroRecord.Star4 { + heroRecord.Star4 = 0 + starIndex = 1 + } + if cfgDraw.DrawFloorStar5 <= heroRecord.Star5 { + heroRecord.Star5 = 0 + starIndex = 2 + } } - // 普通卡池保底 - if cfgDraw.DrawFloorStar4 <= heroRecord.Star4 { - heroRecord.Star4 = 0 - starIndex = 1 - } - if cfgDraw.DrawFloorStar5 <= heroRecord.Star5 { - heroRecord.Star5 = 0 - starIndex = 2 - } szStar = append(szStar, starIndex+3) if len(szStar) >= int(req.DrawCount) { break @@ -107,18 +111,18 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq if req.DrawCount == 1 { switch req.DrawType { case 1: - pool = cfg.Camp1Pool1 + pool = cfgDraw.Camp1Pool1 costAtn = cfgDraw.Camp1PoolCost case 2: - pool = cfg.Camp2Pool1 + pool = cfgDraw.Camp2Pool1 costAtn = cfgDraw.Camp2PoolCost case 3: - pool = cfg.Camp3Pool1 + pool = cfgDraw.Camp3Pool1 costAtn = cfgDraw.Camp3PoolCost case 4: - pool = cfg.Camp4Pool1 + pool = cfgDraw.Camp4Pool1 costAtn = cfgDraw.Camp4PoolCost } strPool = append(strPool, pool) @@ -126,17 +130,17 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq costAtn = cfgDraw.Camp1PoolCost switch req.DrawType { case 1: - pool = cfg.Camp1Pool1 + pool = cfgDraw.Camp1Pool1 costAtn = cfgDraw.Camp1Pool10cost case 2: - pool = cfg.Camp2Pool1 + pool = cfgDraw.Camp2Pool1 costAtn = cfgDraw.Camp2Pool10cost case 3: - pool = cfg.Camp3Pool1 + pool = cfgDraw.Camp3Pool1 costAtn = cfgDraw.Camp3Pool10cost case 4: - pool = cfg.Camp4Pool1 + pool = cfgDraw.Camp4Pool1 costAtn = cfgDraw.Camp4Pool10cost } for i := 0; i < int(req.DrawCount); i++ { diff --git a/modules/hero/module.go b/modules/hero/module.go index 2a64a6a3c..7b33dfc55 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -1,6 +1,7 @@ package hero import ( + "crypto/rand" "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/event" @@ -9,6 +10,7 @@ import ( "go_dreamfactory/pb" "go_dreamfactory/sys/db" "go_dreamfactory/utils" + "math/big" "go.mongodb.org/mongo-driver/bson" ) @@ -396,3 +398,112 @@ func (this *Hero) PushHeroProperty(session comm.IUserSession, heros []*pb.DBHero err = session.SendMsg(string(this.GetType()), "change", &pb.HeroChangePush{List: heros}) return } + +// 充值了多少钱 +func (this *Hero) RechargeMoney(uid string, money int32) { + conf := this.configure.GetGlobalConf() + if conf != nil { + if len(conf.DrawCardRechargeReward) != 2 { + return + } + if money != conf.DrawCardRechargeReward[0] { + return + } + } + if record, err := this.modelRecord.GetHeroRecord(uid); err != nil { + update := map[string]interface{}{} + + if v, ok := record.Condition["recharge"]; !ok { + record.Condition["recharge"] = 0 + } else { + if conf.DrawCardRechargeReward[1] < v { + record.Condition["recharge"] = 0 + } + } + // 同步数据 + update["condition"] = record.Condition + if err := this.modelRecord.ChangeHeroRecord(uid, update); err != nil { + this.Errorf("ChangeHeroRecord error: %v", err) + } + } +} + +// 多少天没登录 +func (this *Hero) NoLoginDay(uid string, day int32) { + conf := this.configure.GetGlobalConf() + if conf != nil { + if len(conf.DrawCardRegressionReward) != 2 { + return + } + if day != conf.DrawCardRegressionReward[0] { + return + } + } + if record, err := this.modelRecord.GetHeroRecord(uid); err != nil { + update := map[string]interface{}{} + + if v, ok := record.Condition["login"]; !ok { + record.Condition["login"] = 0 + } else { + if conf.DrawCardRegressionReward[1] < v { + record.Condition["login"] = 0 + } + } + // 同步数据 + update["condition"] = record.Condition + if err := this.modelRecord.ChangeHeroRecord(uid, update); err != nil { + this.Errorf("ChangeHeroRecord error: %v", err) + } + } +} + +// 检查充值和未登录天数之内抽卡是否抽中 +func (this *apiComp) CheckCondition(uid string, drawCount int32) bool { + var ( + curCount int32 + update map[string]interface{} + ) + update = make(map[string]interface{}, 0) + defer this.module.modelRecord.ChangeHeroRecord(uid, update) + record, _ := this.module.modelRecord.GetHeroRecord(uid) + if v, ok := record.Condition["recharge"]; ok { + conf := this.module.configure.GetGlobalConf() //. + if len(conf.DrawCardRechargeReward) == 2 { + curCount = conf.DrawCardRechargeReward[1] + } + if v >= curCount { // 触发保底 直接给5星 + + delete(record.Condition, "recharge") + update["condition"] = record.Condition + return true + } else { // 1/curCount概率 + n, _ := rand.Int(rand.Reader, big.NewInt(int64(curCount))) + + if n.Int64() < 1 { + + delete(record.Condition, "recharge") + return true + } + record.Condition["recharge"] += 1 + } + } + if v, ok := record.Condition["login"]; ok { + conf := this.module.configure.GetGlobalConf() //. + if len(conf.DrawCardRegressionReward) == 2 { + curCount = conf.DrawCardRegressionReward[1] + } + if v >= curCount { // 触发保底 直接给5星 + delete(record.Condition, "login") + return true + } else { // 1/curCount概率 + n, _ := rand.Int(rand.Reader, big.NewInt(int64(curCount))) + + if n.Int64() < 1 { + delete(record.Condition, "login") + return true + } + record.Condition["login"] += 1 + } + } + return false +} diff --git a/modules/hunting/api_buy.go b/modules/hunting/api_buy.go index 21b9d91c2..4b2e6ff65 100644 --- a/modules/hunting/api_buy.go +++ b/modules/hunting/api_buy.go @@ -48,8 +48,43 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HuntingBuyReq) (code } else { curByCount = list.BuyCount } + conf := this.module.configure.GetGlobalConf() + if conf == nil { + code = pb.ErrorCode_ConfigNoFound + return + } + if list.LeftCount != conf.VikingNum { + if list.RecoveryTime == 0 { + list.RecoveryTime = configure.Now().Unix() + } + count := (configure.Now().Unix() - list.RecoveryTime) / int64(conf.VikingExpeditionRecoveryTime*60) + if count > 1 { + list.LeftCount += int32(count) + } + if list.LeftCount >= conf.VikingNum { + list.LeftCount = conf.VikingNum + list.RecoveryTime = 0 + } else { + list.RecoveryTime += count * int64(conf.VikingExpeditionRecoveryTime*60) // 更新刷新时间 + } + } else { + list.RecoveryTime = 0 + } curByCount += req.Count // 当前需要购买的数量 - // + if this.configure.GetMaxBuyChallengeCount() < curByCount { + code = pb.ErrorCode_VikingBuyMaxCount + return + } + list.LeftCount += req.Count + mapData["leftCount"] = list.LeftCount + if list.LeftCount > conf.VikingNum { + code = pb.ErrorCode_VikingBuyMaxCount + return + } else if list.LeftCount == conf.VikingNum { + list.RecoveryTime = 0 + mapData["recoveryTime"] = list.RecoveryTime // 更新刷新时间 + } + for i := list.BuyCount + 1; i <= curByCount; i++ { _cfg := this.configure.GetBuyChallengeCount(i) if _cfg == nil { @@ -71,11 +106,6 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HuntingBuyReq) (code sz = append(sz, v) } } - // 消耗校验 - if code = this.module.CheckRes(session, sz); code != pb.ErrorCode_Success { - return - } - //消耗 if code = this.module.ConsumeRes(session, sz, true); code != pb.ErrorCode_Success { return diff --git a/modules/hunting/api_challengeover.go b/modules/hunting/api_challengeover.go index 71edb2f4c..5cea62004 100644 --- a/modules/hunting/api_challengeover.go +++ b/modules/hunting/api_challengeover.go @@ -61,14 +61,10 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha } newChallenge = true } - - if newChallenge { // 新关卡挑战通过 发放首通奖励 - if code = this.module.DispenseRes(session, cfg.Firstprize, true); code != pb.ErrorCode_Success { - return - } - hunting.Boss[req.BossType] += 1 - mapData["boss"] = hunting.Boss - mapData["challengeTime"] = hunting.BossTime + // check + code, _ = this.module.battle.CheckBattleReport(session, req.Report) + if code != pb.ErrorCode_Success { + return } if req.Report != nil { costTime = req.Report.Costtime @@ -134,21 +130,26 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha this.module.modulerank.SetRankListData("huntingRank"+strconv.Itoa(int(req.BossType)), req.Difficulty<<16+costTime, objID) } - // check - code, _ = this.module.battle.CheckBattleReport(session, req.Report) - if code != pb.ErrorCode_Success { - return - } // 耗时校验 当前战斗胜利时间消耗小于之前刷新数据 + hunting.LeftCount-- + mapData["leftCount"] = hunting.LeftCount hunting.ChallengeCount++ mapData["challengeCount"] = hunting.ChallengeCount + code = this.module.ModifyHuntingData(session.GetUserId(), mapData) // 发放通关随机奖励 reward = this.module.configure.GetDropReward(cfg.Drop) // 获取掉落奖励 if code = this.module.DispenseRes(session, reward, true); code != pb.ErrorCode_Success { return } - + if newChallenge { // 新关卡挑战通过 发放首通奖励 + if code = this.module.DispenseRes(session, cfg.Firstprize, true); code != pb.ErrorCode_Success { + return + } + hunting.Boss[req.BossType] += 1 + mapData["boss"] = hunting.Boss + mapData["challengeTime"] = hunting.BossTime + } for k := range hunting.Boss { hunting.Boss[k] += 1 } diff --git a/modules/hunting/api_getlist.go b/modules/hunting/api_getlist.go index 6a0f73e79..502859254 100644 --- a/modules/hunting/api_getlist.go +++ b/modules/hunting/api_getlist.go @@ -4,7 +4,6 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/pb" "go_dreamfactory/sys/configure" - "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -28,16 +27,28 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.HuntingGetListRe return } - // 校验 是不是当天 - if !utils.IsToday(list.CTime) { - list.CTime = configure.Now().Unix() - list.BuyCount = 0 - list.ChallengeCount = 0 - mapData := make(map[string]interface{}, 0) - mapData["cTime"] = list.CTime - mapData["buyCount"] = list.BuyCount - mapData["challengeCount"] = list.ChallengeCount - code = this.module.ModifyHuntingData(session.GetUserId(), mapData) //修改内存信息 + // 检查恢复时间 + conf := this.module.configure.GetGlobalConf() + if conf == nil { + code = pb.ErrorCode_ConfigNoFound + return + } + if list.LeftCount != conf.VikingNum { + if list.RecoveryTime == 0 { + list.RecoveryTime = configure.Now().Unix() + } + count := (configure.Now().Unix() - list.RecoveryTime) / int64(conf.VikingExpeditionRecoveryTime*60) // 暂时用维京配置 11月21号统一修改配置 + if count > 1 { + list.LeftCount += int32(count) + } + if list.LeftCount >= conf.VikingNum { + list.LeftCount = conf.VikingNum + list.RecoveryTime = 0 + } else { + list.RecoveryTime += count * int64(conf.VikingExpeditionRecoveryTime*60) // 更新刷新时间 + } + } else { + list.RecoveryTime = 0 } for k := range list.Boss { list.Boss[k] += 1 diff --git a/modules/hunting/comp_configure.go b/modules/hunting/comp_configure.go index a31a30df7..052b03479 100644 --- a/modules/hunting/comp_configure.go +++ b/modules/hunting/comp_configure.go @@ -99,3 +99,14 @@ func (this *configureComp) GetBuyChallengeCount(index int32) (data *cfg.GameHunt return } +func (this *configureComp) GetMaxBuyChallengeCount() int32 { + if v, err := this.GetConfigure(game_challenge); err == nil { + if configure, ok := v.(*cfg.GameHuntingChallenge); ok { + return int32(len(configure.GetDataList())) + } + } else { + log.Errorf("get game_challenge conf err:%v", err) + } + + return 0 +} diff --git a/modules/hunting/model_hunting.go b/modules/hunting/model_hunting.go index c7b9706fe..275794fad 100644 --- a/modules/hunting/model_hunting.go +++ b/modules/hunting/model_hunting.go @@ -53,8 +53,13 @@ func (this *modelHunting) getHuntingList(uid string) (result *pb.DBHunting, err str := strconv.Itoa(int(k)) + "_1" result.BossTime[str] = 0 } + conf := this.module.configure.GetGlobalConf() + if conf != nil { + result.LeftCount = conf.VikingNum // 初始账号给默认最大挑战次数 + } + } - this.module.modelHunting.Add(uid, result) + this.Add(uid, result) } err = nil return result, err diff --git a/modules/viking/api_buy.go b/modules/viking/api_buy.go index b651468ba..9bd2950fa 100644 --- a/modules/viking/api_buy.go +++ b/modules/viking/api_buy.go @@ -108,11 +108,6 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.VikingBuyReq) (code sz = append(sz, v) } } - // 消耗校验 - if code = this.module.CheckRes(session, sz); code != pb.ErrorCode_Success { - return - } - //消耗 if code = this.module.ConsumeRes(session, sz, true); code != pb.ErrorCode_Success { return diff --git a/pb/hero_db.pb.go b/pb/hero_db.pb.go index 0c065dbd2..f8c467e82 100644 --- a/pb/hero_db.pb.go +++ b/pb/hero_db.pb.go @@ -430,12 +430,16 @@ type DBHeroRecord struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID 主键id - Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID - Star4 int32 `protobuf:"varint,3,opt,name=star4,proto3" json:"star4"` // 4星保底 - Star5 int32 `protobuf:"varint,4,opt,name=star5,proto3" json:"star5"` // 5星保底 - Mtime int64 `protobuf:"varint,5,opt,name=mtime,proto3" json:"mtime"` // 修改时间 - Drawcount int32 `protobuf:"varint,6,opt,name=drawcount,proto3" json:"drawcount"` // 普通卡牌累计抽取次数 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID 主键id + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID + Star4 int32 `protobuf:"varint,3,opt,name=star4,proto3" json:"star4"` // 4星保底 + Star5 int32 `protobuf:"varint,4,opt,name=star5,proto3" json:"star5"` // 5星保底 + Mtime int64 `protobuf:"varint,5,opt,name=mtime,proto3" json:"mtime"` // 修改时间 + Drawcount int32 `protobuf:"varint,6,opt,name=drawcount,proto3" json:"drawcount"` // 普通卡牌累计抽取次数 + Condition map[string]int32 `protobuf:"bytes,7,rep,name=condition,proto3" json:"condition" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key recharge、login 等 value 累计抽卡次数 + Star5Hero map[string]int32 `protobuf:"bytes,8,rep,name=star5Hero,proto3" json:"star5Hero" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 第totalcount 次抽到的5星英雄 key 英雄id + Totalcount int32 `protobuf:"varint,9,opt,name=totalcount,proto3" json:"totalcount"` // 总的累计抽卡次数 + Daycount int32 `protobuf:"varint,10,opt,name=daycount,proto3" json:"daycount"` // 今天抽卡次数 } func (x *DBHeroRecord) Reset() { @@ -512,6 +516,34 @@ func (x *DBHeroRecord) GetDrawcount() int32 { return 0 } +func (x *DBHeroRecord) GetCondition() map[string]int32 { + if x != nil { + return x.Condition + } + return nil +} + +func (x *DBHeroRecord) GetStar5Hero() map[string]int32 { + if x != nil { + return x.Star5Hero + } + return nil +} + +func (x *DBHeroRecord) GetTotalcount() int32 { + if x != nil { + return x.Totalcount + } + return 0 +} + +func (x *DBHeroRecord) GetDaycount() int32 { + if x != nil { + return x.Daycount + } + return 0 +} + // 英雄天赋系统 type DBHeroTalent struct { state protoimpl.MessageState @@ -695,7 +727,7 @@ var file_hero_hero_db_proto_rawDesc = []byte{ 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x27, 0x0a, 0x05, 0x46, 0x6c, 0x6f, 0x6f, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x68, 0x34, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x68, 0x34, 0x12, 0x0e, 0x0a, 0x02, 0x68, 0x35, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x68, 0x35, 0x22, - 0x90, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0xc0, 0x03, 0x0a, 0x0c, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 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, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x34, 0x18, 0x03, 0x20, 0x01, 0x28, @@ -704,7 +736,26 @@ var file_hero_hero_db_proto_rawDesc = []byte{ 0x0a, 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x72, 0x61, 0x77, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x64, 0x72, 0x61, 0x77, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x22, 0xb6, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x61, 0x6c, + 0x6e, 0x74, 0x12, 0x3a, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3a, + 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x35, 0x48, 0x65, 0x72, 0x6f, 0x18, 0x08, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1c, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x2e, 0x53, 0x74, 0x61, 0x72, 0x35, 0x48, 0x65, 0x72, 0x6f, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x09, 0x73, 0x74, 0x61, 0x72, 0x35, 0x48, 0x65, 0x72, 0x6f, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, + 0x74, 0x61, 0x6c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x61, + 0x79, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x61, + 0x79, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x3c, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 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, 0x1a, 0x3c, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x72, 0x35, 0x48, 0x65, 0x72, + 0x6f, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 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, 0xb6, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 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, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, @@ -735,7 +786,7 @@ func file_hero_hero_db_proto_rawDescGZIP() []byte { } var file_hero_hero_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_hero_hero_db_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_hero_hero_db_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_hero_hero_db_proto_goTypes = []interface{}{ (HeroType)(0), // 0: HeroType (*DBHero)(nil), // 1: DBHero @@ -749,11 +800,13 @@ var file_hero_hero_db_proto_goTypes = []interface{}{ nil, // 9: DBHero.JuexPropertyEntry nil, // 10: DBHero.TalentPropertyEntry nil, // 11: DBHero.HoroscopePropertyEntry - nil, // 12: DBHeroTalent.TalentEntry - (*SkillData)(nil), // 13: SkillData + nil, // 12: DBHeroRecord.ConditionEntry + nil, // 13: DBHeroRecord.Star5HeroEntry + nil, // 14: DBHeroTalent.TalentEntry + (*SkillData)(nil), // 15: SkillData } var file_hero_hero_db_proto_depIdxs = []int32{ - 13, // 0: DBHero.normalSkill:type_name -> SkillData + 15, // 0: DBHero.normalSkill:type_name -> SkillData 5, // 1: DBHero.property:type_name -> DBHero.PropertyEntry 6, // 2: DBHero.addProperty:type_name -> DBHero.AddPropertyEntry 7, // 3: DBHero.energy:type_name -> DBHero.EnergyEntry @@ -761,14 +814,16 @@ var file_hero_hero_db_proto_depIdxs = []int32{ 9, // 5: DBHero.juexProperty:type_name -> DBHero.JuexPropertyEntry 0, // 6: DBHero.status:type_name -> HeroType 10, // 7: DBHero.talentProperty:type_name -> DBHero.TalentPropertyEntry - 13, // 8: DBHero.equipSkill:type_name -> SkillData + 15, // 8: DBHero.equipSkill:type_name -> SkillData 11, // 9: DBHero.horoscopeProperty:type_name -> DBHero.HoroscopePropertyEntry - 12, // 10: DBHeroTalent.talent:type_name -> DBHeroTalent.TalentEntry - 11, // [11:11] is the sub-list for method output_type - 11, // [11:11] is the sub-list for method input_type - 11, // [11:11] is the sub-list for extension type_name - 11, // [11:11] is the sub-list for extension extendee - 0, // [0:11] is the sub-list for field type_name + 12, // 10: DBHeroRecord.condition:type_name -> DBHeroRecord.ConditionEntry + 13, // 11: DBHeroRecord.star5Hero:type_name -> DBHeroRecord.Star5HeroEntry + 14, // 12: DBHeroTalent.talent:type_name -> DBHeroTalent.TalentEntry + 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_hero_hero_db_proto_init() } @@ -833,7 +888,7 @@ func file_hero_hero_db_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_hero_hero_db_proto_rawDesc, NumEnums: 1, - NumMessages: 12, + NumMessages: 14, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/hunting_db.pb.go b/pb/hunting_db.pb.go index 20333967b..46bea821d 100644 --- a/pb/hunting_db.pb.go +++ b/pb/hunting_db.pb.go @@ -32,6 +32,8 @@ type DBHunting struct { BuyCount int32 `protobuf:"varint,5,opt,name=buyCount,proto3" json:"buyCount" bson:"buyCount"` //购买次数 CTime int64 `protobuf:"varint,6,opt,name=cTime,proto3" json:"cTime" bson:"cTime"` //修改时间 BossTime map[string]int32 `protobuf:"bytes,7,rep,name=bossTime,proto3" json:"bossTime" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"bossTime"` // + LeftCount int32 `protobuf:"varint,8,opt,name=leftCount,proto3" json:"leftCount" bson:"leftCount"` // 当前剩余挑战次数 // 最大不能超过配置 + RecoveryTime int64 `protobuf:"varint,9,opt,name=recoveryTime,proto3" json:"recoveryTime" bson:"recoveryTime"` //// 开始恢复的时间 } func (x *DBHunting) Reset() { @@ -115,6 +117,20 @@ func (x *DBHunting) GetBossTime() map[string]int32 { return nil } +func (x *DBHunting) GetLeftCount() int32 { + if x != nil { + return x.LeftCount + } + return 0 +} + +func (x *DBHunting) GetRecoveryTime() int64 { + if x != nil { + return x.RecoveryTime + } + return 0 +} + // 狩猎排行榜 type DBHuntingRank struct { state protoimpl.MessageState @@ -241,7 +257,7 @@ var file_hunting_hunting_db_proto_rawDesc = []byte{ 0x0a, 0x18, 0x68, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x68, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x2f, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0xdd, 0x02, 0x0a, 0x09, 0x44, 0x42, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, + 0x6f, 0x74, 0x6f, 0x22, 0x9f, 0x03, 0x0a, 0x09, 0x44, 0x42, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 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, 0x26, 0x0a, 0x0e, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, @@ -255,32 +271,36 @@ var file_hunting_hunting_db_proto_rawDesc = []byte{ 0x52, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x34, 0x0a, 0x08, 0x62, 0x6f, 0x73, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x44, 0x42, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x6f, 0x73, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x52, 0x08, 0x62, 0x6f, 0x73, 0x73, 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, 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, 0x09, 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, 0x80, 0x02, 0x0a, 0x0d, 0x44, 0x42, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, - 0x67, 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, 0x1e, 0x0a, 0x0a, 0x64, 0x69, 0x66, 0x66, 0x69, - 0x63, 0x75, 0x6c, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x64, 0x69, 0x66, - 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x6f, 0x73, 0x73, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x62, 0x6f, 0x73, 0x73, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, - 0x63, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x02, 0x6c, 0x76, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x70, 0x6f, 0x73, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x70, 0x6f, 0x73, 0x12, 0x1b, 0x0a, - 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x09, 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, 0x0a, 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, + 0x74, 0x72, 0x79, 0x52, 0x08, 0x62, 0x6f, 0x73, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, + 0x09, 0x6c, 0x65, 0x66, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x09, 0x6c, 0x65, 0x66, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x72, + 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0c, 0x72, 0x65, 0x63, 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, 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, 0x09, 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, 0x80, 0x02, 0x0a, 0x0d, 0x44, 0x42, 0x48, 0x75, 0x6e, 0x74, + 0x69, 0x6e, 0x67, 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, 0x1e, 0x0a, 0x0a, 0x64, 0x69, 0x66, + 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x64, + 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x6f, 0x73, + 0x73, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x62, 0x6f, 0x73, + 0x73, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x70, 0x6f, 0x73, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x70, 0x6f, 0x73, 0x12, + 0x1b, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x09, 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, 0x0a, 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, } var (