diff --git a/modules/hunting/api_challenge.go b/modules/hunting/api_challenge.go index 5dd7eb7ca..2a805de8f 100644 --- a/modules/hunting/api_challenge.go +++ b/modules/hunting/api_challenge.go @@ -10,7 +10,7 @@ import ( //参数校验 func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.HuntingChallengeReq) (code pb.ErrorCode) { - if req.BossType <= 0 && req.Difficulty != 0 { + if req.BossType <= 0 && req.Difficulty > 0 { code = pb.ErrorCode_ReqParameterError return } @@ -37,37 +37,34 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen return } cfg := this.module.configure.GetHuntingBossConfigData(req.BossType, req.Difficulty) - if cfg != nil { + if cfg == nil { code = pb.ErrorCode_ConfigNoFound return } - if value, ok := hunting.Boos[req.BossType]; !ok { // 类型校验 - code = pb.ErrorCode_VikingBoosType - return - } else { - if value < req.Difficulty { - if value+1 != req.Difficulty { - code = pb.ErrorCode_VikingLvErr - return - } - newChallenge = true - } else { // 挑战历史 - newChallenge = false + value, ok := hunting.Boss[req.BossType] + if !ok { // 类型校验 + hunting.Boss[req.BossType] = 0 + } + if value < req.Difficulty { + if value+1 != req.Difficulty { + code = pb.ErrorCode_VikingLvErr + return } + newChallenge = true } if newChallenge { // 新关卡挑战通过 发放首通奖励 if code = this.module.DispenseRes(session, cfg.Firstprize, true); code != pb.ErrorCode_Success { return } - hunting.Boos[req.BossType] += 1 - mapData["boos"] = hunting.Boos - hunting.ChallengeTime[req.BossType<<16+req.Difficulty] = 0 // todo 耗时 - mapData["challengeTime"] = hunting.ChallengeTime + hunting.Boss[req.BossType] += 1 + mapData["boos"] = hunting.Boss + //hunting.BossTime[] = 0 // todo 耗时 + mapData["challengeTime"] = hunting.BossTime } // 耗时校验 当前战斗胜利时间消耗小于之前刷新数据 - hunting.ChallengeTime[req.BossType<<16+req.Difficulty] = 0 + //hunting.BossTime[] = 0 code = this.module.ModifyHuntingData(session.GetUserId(), mapData) // 发放通关随机奖励 this.module.configure.GetDropReward(cfg.Drop, reward) // 获取掉落奖励 diff --git a/modules/hunting/api_getlist.go b/modules/hunting/api_getlist.go index 71cc8b800..88652b99c 100644 --- a/modules/hunting/api_getlist.go +++ b/modules/hunting/api_getlist.go @@ -4,9 +4,9 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/pb" "go_dreamfactory/utils" + "strconv" "time" - "go.mongodb.org/mongo-driver/bson/primitive" "google.golang.org/protobuf/proto" ) @@ -22,20 +22,19 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.HuntingGetListRe if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 } + list, err := this.module.modelHunting.getHuntingList(session.GetUserId()) if err != nil { code = pb.ErrorCode_DBError return } - if list == nil { - list.Id = primitive.NewObjectID().Hex() - list.Uid = session.GetUserId() - list.Boos = make(map[int32]int32) - _mapType := this.configure.GetHuntingBossTypeConfigData() - for k := range _mapType { - list.Boos[k] = 0 // 默认难度0 + if len(list.Boss) == 0 { + _cfg := this.module.configure.GetHuntingBossTypeConfigData() + for k := range _cfg { + list.Boss[k] = 0 + str := strconv.Itoa(int(k)) + "_0" + list.BossTime[str] = 0 } - this.module.modelHunting.Add(session.GetUserId(), list) // 写缓存 } // 校验 是不是当天 if !utils.IsToday(list.CTime) { @@ -49,5 +48,10 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.HuntingGetListRe code = this.module.ModifyHuntingData(session.GetUserId(), mapData) //修改内存信息 } session.SendMsg(string(this.module.GetType()), HuntingGetListResp, &pb.HuntingGetListResp{Data: list}) + r := &pb.HuntingChallengeReq{ + BossType: 1, + Difficulty: 0, + } + this.Challenge(session, r) return } diff --git a/modules/hunting/model_hunting.go b/modules/hunting/model_hunting.go index 3b005ca74..ff63b101a 100644 --- a/modules/hunting/model_hunting.go +++ b/modules/hunting/model_hunting.go @@ -3,10 +3,11 @@ package hunting import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" - "go_dreamfactory/lego/sys/redis" + "go_dreamfactory/lego/sys/mgo" "go_dreamfactory/modules" "go_dreamfactory/pb" + "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/x/bsonx" ) @@ -33,10 +34,19 @@ func (this *modelHunting) modifyHuntingDataByObjId(uid string, data map[string]i // 获取列表信息 func (this *modelHunting) getHuntingList(uid string) (result *pb.DBHunting, err error) { - result = &pb.DBHunting{} - if err = this.Get(uid, result); err != nil && redis.RedisNil != err { + result = &pb.DBHunting{ + Id: primitive.NewObjectID().Hex(), + Uid: uid, + Boss: make(map[int32]int32), + BossTime: make(map[string]int32), + } + if err = this.Get(uid, result); err != nil && mgo.MongodbNil != err { + return } + if mgo.MongodbNil == err { + this.module.modelHunting.Add(uid, result) + } err = nil return result, err } diff --git a/modules/viking/api_challenge.go b/modules/viking/api_challenge.go index 42ef620be..522c70810 100644 --- a/modules/viking/api_challenge.go +++ b/modules/viking/api_challenge.go @@ -10,7 +10,7 @@ import ( //参数校验 func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.VikingChallengeReq) (code pb.ErrorCode) { - if req.BossType <= 0 && req.Difficulty != 0 { + if req.BossType <= 0 && req.Difficulty > 0 { code = pb.ErrorCode_ReqParameterError return } @@ -42,19 +42,17 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng return } - if value, ok := viking.Boss[req.BossType]; !ok { // 类型校验 + value, ok := viking.Boss[req.BossType] + if !ok { // 类型校验 viking.Boss[req.BossType] = 0 - if value < req.Difficulty { - if value+1 != req.Difficulty { - code = pb.ErrorCode_VikingLvErr - return - } - newChallenge = true - } else { // 挑战历史 - newChallenge = false - } } - + if value < req.Difficulty { + if value+1 != req.Difficulty { + code = pb.ErrorCode_VikingLvErr + return + } + newChallenge = true + } if newChallenge { // 新关卡挑战通过 发放首通奖励 if code = this.module.DispenseRes(session, cfg.Firstprize, true); code != pb.ErrorCode_Success { return diff --git a/modules/viking/api_getlist.go b/modules/viking/api_getlist.go index 7e3b6307b..84b57b57f 100644 --- a/modules/viking/api_getlist.go +++ b/modules/viking/api_getlist.go @@ -48,5 +48,11 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.VikingGetListReq code = this.module.ModifyVikingData(session.GetUserId(), mapData) //修改内存信息 } session.SendMsg(string(this.module.GetType()), VikingGetListResp, &pb.VikingGetListResp{Data: list}) + + r := &pb.VikingChallengeReq{ + BossType: 1, + Difficulty: 1, + } + this.Challenge(session, r) return } diff --git a/pb/hunting_db.pb.go b/pb/hunting_db.pb.go index e8cbbe590..282bf4686 100644 --- a/pb/hunting_db.pb.go +++ b/pb/hunting_db.pb.go @@ -25,13 +25,13 @@ type DBHunting struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - 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 - ChallengeCount int32 `protobuf:"varint,3,opt,name=challengeCount,proto3" json:"challengeCount" bson:"challengeCount"` //挑战次数 - Boos map[int32]int32 `protobuf:"bytes,4,rep,name=boos,proto3" json:"boos" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key boos 类型 value 难度 - 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"` //修改时间 - ChallengeTime map[int32]int32 `protobuf:"bytes,7,rep,name=challengeTime,proto3" json:"challengeTime" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"challengeTime"` //每个难度通关时间 + 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 + ChallengeCount int32 `protobuf:"varint,3,opt,name=challengeCount,proto3" json:"challengeCount" bson:"challengeCount"` //挑战次数 + Boss map[int32]int32 `protobuf:"bytes,4,rep,name=boss,proto3" json:"boss" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key boos 类型 value 难度 + 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"` // } func (x *DBHunting) Reset() { @@ -87,9 +87,9 @@ func (x *DBHunting) GetChallengeCount() int32 { return 0 } -func (x *DBHunting) GetBoos() map[int32]int32 { +func (x *DBHunting) GetBoss() map[int32]int32 { if x != nil { - return x.Boos + return x.Boss } return nil } @@ -108,9 +108,9 @@ func (x *DBHunting) GetCTime() int64 { return 0 } -func (x *DBHunting) GetChallengeTime() map[int32]int32 { +func (x *DBHunting) GetBossTime() map[string]int32 { if x != nil { - return x.ChallengeTime + return x.BossTime } return nil } @@ -223,44 +223,43 @@ var File_hunting_hunting_db_proto protoreflect.FileDescriptor 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, 0x22, 0xf1, 0x02, 0x0a, 0x09, 0x44, + 0x67, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdd, 0x02, 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, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x44, 0x42, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x6f, 0x6f, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x73, 0x12, 0x1a, 0x0a, 0x08, + 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x62, 0x6f, 0x73, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x14, 0x2e, 0x44, 0x42, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x6f, 0x73, + 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x75, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x62, 0x75, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x54, 0x69, 0x6d, - 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x43, - 0x0a, 0x0d, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, - 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x44, 0x42, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, - 0x67, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0d, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x54, - 0x69, 0x6d, 0x65, 0x1a, 0x37, 0x0a, 0x09, 0x42, 0x6f, 0x6f, 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, 0x40, 0x0a, 0x12, - 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 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, 0xc9, - 0x01, 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, 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, + 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 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, 0xc9, 0x01, 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, 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, } var ( @@ -279,12 +278,12 @@ var file_hunting_hunting_db_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_hunting_hunting_db_proto_goTypes = []interface{}{ (*DBHunting)(nil), // 0: DBHunting (*DBHuntingRank)(nil), // 1: DBHuntingRank - nil, // 2: DBHunting.BoosEntry - nil, // 3: DBHunting.ChallengeTimeEntry + nil, // 2: DBHunting.BossEntry + nil, // 3: DBHunting.BossTimeEntry } var file_hunting_hunting_db_proto_depIdxs = []int32{ - 2, // 0: DBHunting.boos:type_name -> DBHunting.BoosEntry - 3, // 1: DBHunting.challengeTime:type_name -> DBHunting.ChallengeTimeEntry + 2, // 0: DBHunting.boss:type_name -> DBHunting.BossEntry + 3, // 1: DBHunting.bossTime:type_name -> DBHunting.BossTimeEntry 2, // [2:2] is the sub-list for method output_type 2, // [2:2] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name diff --git a/pb/viking_db.pb.go b/pb/viking_db.pb.go index b9997c6d6..aa3ab4929 100644 --- a/pb/viking_db.pb.go +++ b/pb/viking_db.pb.go @@ -116,26 +116,92 @@ func (x *DBViking) GetBossTime() map[string]int32 { return nil } +// 阵型数据 +type LineUp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid"` // 配置表id + Star int32 `protobuf:"varint,2,opt,name=star,proto3" json:"star"` // 星级 + Lv int32 `protobuf:"varint,3,opt,name=lv,proto3" json:"lv"` // 等级 +} + +func (x *LineUp) Reset() { + *x = LineUp{} + if protoimpl.UnsafeEnabled { + mi := &file_viking_viking_db_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LineUp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LineUp) ProtoMessage() {} + +func (x *LineUp) ProtoReflect() protoreflect.Message { + mi := &file_viking_viking_db_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LineUp.ProtoReflect.Descriptor instead. +func (*LineUp) Descriptor() ([]byte, []int) { + return file_viking_viking_db_proto_rawDescGZIP(), []int{1} +} + +func (x *LineUp) GetCid() string { + if x != nil { + return x.Cid + } + return "" +} + +func (x *LineUp) GetStar() int32 { + if x != nil { + return x.Star + } + return 0 +} + +func (x *LineUp) GetLv() int32 { + if x != nil { + return x.Lv + } + return 0 +} + // 维京远征排行榜 type DBVikingRank struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - 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 - Difficulty int32 `protobuf:"varint,3,opt,name=difficulty,proto3" json:"difficulty"` // 难度 - Bosstype int32 `protobuf:"varint,4,opt,name=bosstype,proto3" json:"bosstype"` // boss类型塔类型 - Nickname string `protobuf:"bytes,5,opt,name=nickname,proto3" json:"nickname"` // 昵称 - Icon string `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon"` // 玩家头像 - Lv int32 `protobuf:"varint,7,opt,name=lv,proto3" json:"lv"` // 玩家等级 - CostTime int32 `protobuf:"varint,8,opt,name=costTime,proto3" json:"costTime" bson:"costTime"` //闯关耗时 单位s + 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 + Difficulty int32 `protobuf:"varint,3,opt,name=difficulty,proto3" json:"difficulty"` // 难度 + Bosstype int32 `protobuf:"varint,4,opt,name=bosstype,proto3" json:"bosstype"` // boss类型塔类型 + Nickname string `protobuf:"bytes,5,opt,name=nickname,proto3" json:"nickname"` // 昵称 + Icon string `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon"` // 玩家头像 + Lv int32 `protobuf:"varint,7,opt,name=lv,proto3" json:"lv"` // 玩家等级 + Leadpos int32 `protobuf:"varint,8,opt,name=leadpos,proto3" json:"leadpos"` //队长位置 + Line []*LineUp `protobuf:"bytes,9,rep,name=line,proto3" json:"line"` // 阵容数据 + CostTime int32 `protobuf:"varint,10,opt,name=costTime,proto3" json:"costTime" bson:"costTime"` //闯关耗时 单位s } func (x *DBVikingRank) Reset() { *x = DBVikingRank{} if protoimpl.UnsafeEnabled { - mi := &file_viking_viking_db_proto_msgTypes[1] + mi := &file_viking_viking_db_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -148,7 +214,7 @@ func (x *DBVikingRank) String() string { func (*DBVikingRank) ProtoMessage() {} func (x *DBVikingRank) ProtoReflect() protoreflect.Message { - mi := &file_viking_viking_db_proto_msgTypes[1] + mi := &file_viking_viking_db_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -161,7 +227,7 @@ func (x *DBVikingRank) ProtoReflect() protoreflect.Message { // Deprecated: Use DBVikingRank.ProtoReflect.Descriptor instead. func (*DBVikingRank) Descriptor() ([]byte, []int) { - return file_viking_viking_db_proto_rawDescGZIP(), []int{1} + return file_viking_viking_db_proto_rawDescGZIP(), []int{2} } func (x *DBVikingRank) GetId() string { @@ -213,6 +279,20 @@ func (x *DBVikingRank) GetLv() int32 { return 0 } +func (x *DBVikingRank) GetLeadpos() int32 { + if x != nil { + return x.Leadpos + } + return 0 +} + +func (x *DBVikingRank) GetLine() []*LineUp { + if x != nil { + return x.Line + } + return nil +} + func (x *DBVikingRank) GetCostTime() int32 { if x != nil { return x.CostTime @@ -246,7 +326,11 @@ var file_viking_viking_db_proto_rawDesc = []byte{ 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, 0xc8, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x56, 0x69, 0x6b, 0x69, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x3e, 0x0a, 0x06, 0x4c, 0x69, 0x6e, 0x65, 0x55, 0x70, 0x12, + 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x69, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x61, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x04, 0x73, 0x74, 0x61, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x02, 0x6c, 0x76, 0x22, 0xff, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x56, 0x69, 0x6b, 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, @@ -257,9 +341,13 @@ var file_viking_viking_db_proto_rawDesc = []byte{ 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, 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, + 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 ( @@ -274,21 +362,23 @@ func file_viking_viking_db_proto_rawDescGZIP() []byte { return file_viking_viking_db_proto_rawDescData } -var file_viking_viking_db_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_viking_viking_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_viking_viking_db_proto_goTypes = []interface{}{ (*DBViking)(nil), // 0: DBViking - (*DBVikingRank)(nil), // 1: DBVikingRank - nil, // 2: DBViking.BossEntry - nil, // 3: DBViking.BossTimeEntry + (*LineUp)(nil), // 1: LineUp + (*DBVikingRank)(nil), // 2: DBVikingRank + nil, // 3: DBViking.BossEntry + nil, // 4: DBViking.BossTimeEntry } var file_viking_viking_db_proto_depIdxs = []int32{ - 2, // 0: DBViking.boss:type_name -> DBViking.BossEntry - 3, // 1: DBViking.bossTime:type_name -> DBViking.BossTimeEntry - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 3, // 0: DBViking.boss:type_name -> DBViking.BossEntry + 4, // 1: DBViking.bossTime:type_name -> DBViking.BossTimeEntry + 1, // 2: DBVikingRank.line:type_name -> LineUp + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_viking_viking_db_proto_init() } @@ -310,6 +400,18 @@ func file_viking_viking_db_proto_init() { } } file_viking_viking_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LineUp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_viking_viking_db_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DBVikingRank); i { case 0: return &v.state @@ -328,7 +430,7 @@ func file_viking_viking_db_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_viking_viking_db_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 5, NumExtensions: 0, NumServices: 0, },