diff --git a/modules/expedition/api_info.go b/modules/expedition/api_info.go index 69e8b2020..16a3b1b76 100644 --- a/modules/expedition/api_info.go +++ b/modules/expedition/api_info.go @@ -1,6 +1,7 @@ package expedition import ( + "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" @@ -18,19 +19,21 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.ExpeditionInfoReq) var ( member *pb.DBGuildMember info *pb.DBExpedition + boos *pb.DBExpeditionBoos err error ) if errdata = this.InfoCheck(session, req); errdata != nil { return } - lock, _ := this.module.modelExpedition.userlock(req.Guildid) + state := getSysDayTimeState() + lock, _ := this.module.model.userlock(req.Guildid) err = lock.Lock() if err != nil { this.module.Error("公会战分布式锁 err!", log.Field{Key: "Guildid", Value: req.Guildid}, log.Field{Key: "err", Value: err.Error()}) return } defer lock.Unlock() - if info, err = this.module.modelExpedition.getInfo(req.Guildid); err != nil { + if info, err = this.module.model.getInfo(req.Guildid); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_DBError, Message: err.Error(), @@ -38,8 +41,25 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.ExpeditionInfoReq) return } if !utils.IsSameWeek(member.Refreshtime) { - this.module.modelExpedition.refreshBoos(info) + this.module.model.refreshBoos(info) } - session.SendMsg(string(this.module.GetType()), "info", &pb.ExpeditionInfoResp{Info: info}) + + if state == 2 || state == 3 { + boos = info.Boos[info.Indexboos] + if boos == nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_SystemError, + Message: fmt.Sprintf("no found currboos:%d", info.Indexboos), + } + return + } + if !boos.Crusaded { + if this.module.model.settlementboos(info, boos) { + this.module.model.updateExpedition(info) + } + } + } + + session.SendMsg(string(this.module.GetType()), "info", &pb.ExpeditionInfoResp{Info: info, State: state}) return } diff --git a/modules/expedition/api_receive.go b/modules/expedition/api_receive.go new file mode 100644 index 000000000..ade27e164 --- /dev/null +++ b/modules/expedition/api_receive.go @@ -0,0 +1,137 @@ +package expedition + +import ( + "fmt" + "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" + "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" +) + +// 参数校验 +func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.ExpeditionReceiveReq) (errdata *pb.ErrorData) { + + return +} + +// 获取工会boos战信息 +func (this *apiComp) Receive(session comm.IUserSession, req *pb.ExpeditionReceiveReq) (errdata *pb.ErrorData) { + var ( + conf *cfg.GameExpeditionBoosData + info *pb.DBExpedition + boos *pb.DBExpeditionBoos + member *pb.DBExpeditionMember + award []*pb.UserAtno + err error + ok bool + ) + if errdata = this.ReceiveCheck(session, req); errdata != nil { + return + } + lock, _ := this.module.model.userlock(req.Guildid) + err = lock.Lock() + if err != nil { + this.module.Error("公会战分布式锁 err!", log.Field{Key: "Guildid", Value: req.Guildid}, log.Field{Key: "err", Value: err.Error()}) + return + } + defer lock.Unlock() + if info, err = this.module.model.getInfo(req.Guildid); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Message: err.Error(), + } + return + } + for _, v := range info.Boos { + if v.Boosid == req.Boosid { + boos = v + } + } + if boos == nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_SystemError, + Message: fmt.Sprintf("no found currboos:%d", req.Boosid), + } + return + } + if !boos.Crusaded { + this.module.model.settlementboos(info, boos) + } + if conf, err = this.module.configure.getGameExpeditionBoosData(boos.Boosid); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Message: err.Error(), + } + return + } + if boos.Hp > 0 { + if state := getSysDayTimeState(); state != 2 { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Message: "curr no in award time!", + } + return + } + if member, ok = boos.Members[session.GetUserId()]; !ok || member.State == 0 { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Message: "Not involved!", + } + return + } + member.State = 2 + if errdata, award = this.module.DispenseAtno(session, conf.FailReward, true); errdata != nil { + return + } + } else { + if member, ok = boos.Members[session.GetUserId()]; ok { + if member.State == 2 { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Message: "Received!", + } + return + } + member.State = 2 + } else { + boos.Members[session.GetUserId()] = &pb.DBExpeditionMember{ + Uid: session.GetUserId(), + State: 2, + } + } + + user, err := this.module.GetUserForSession(session) + if err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + + if prop := this.module.ModuleTools.GetGroupDataByLottery(conf.KillReward, user.Vip, user.Lv); len(prop) == 0 { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), + Message: fmt.Sprintf("掉落组未找到:%d", conf.KillReward), + } + return + } else { + if errdata, award = this.module.DispenseAtno(session, prop, true); errdata != nil { + return + } + } + } + + if err = this.module.model.updateExpedition(info); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Message: err.Error(), + } + return + } + + session.SendMsg(string(this.module.GetType()), "info", &pb.ExpeditionReceiveResp{Boosid: req.Boosid, Award: award}) + return +} diff --git a/modules/expedition/api_uphero.go b/modules/expedition/api_uphero.go index 80b2dfa1d..55b44209f 100644 --- a/modules/expedition/api_uphero.go +++ b/modules/expedition/api_uphero.go @@ -5,6 +5,8 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" + "math" ) // 参数校验 @@ -16,67 +18,123 @@ func (this *apiComp) UpHeroCheck(session comm.IUserSession, req *pb.ExpeditionUp // 获取工会boos战信息 func (this *apiComp) UpHero(session comm.IUserSession, req *pb.ExpeditionUpHeroReq) (errdata *pb.ErrorData) { var ( - // conf *cfg.GameExpeditionBoosData - member *pb.DBExpeditionMember - info *pb.DBExpedition - boos *pb.DBExpeditionBoos - // heros []*pb.DBHero - err error + conf *cfg.GameExpeditionBoosData + hconf *cfg.GameHeroData + member *pb.DBExpeditionMember + info *pb.DBExpedition + boos *pb.DBExpeditionBoos + heros []*pb.DBHero + condition []int32 + addpwaer int32 + err error ) if errdata = this.UpHeroCheck(session, req); errdata != nil { return } - - lock, _ := this.module.modelExpedition.userlock(req.Guildid) + if state := getSysDayTimeState(); state != 1 { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Message: "curr no in uptime!", + } + return + } + lock, _ := this.module.model.userlock(req.Guildid) err = lock.Lock() if err != nil { this.module.Error("公会战分布式锁 err!", log.Field{Key: "Guildid", Value: req.Guildid}, log.Field{Key: "err", Value: err.Error()}) return } defer lock.Unlock() - if info, err = this.module.modelExpedition.getInfo(req.Guildid); err != nil { + if info, err = this.module.model.getInfo(req.Guildid); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_DBError, Message: err.Error(), } return } - for _, v := range info.Boos { - if v.Boosid == info.Currboos { - boos = v - } - } - + boos = info.Boos[info.Indexboos] if boos == nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_SystemError, - Message: fmt.Sprintf("no found currboos:%d", info.Currboos), + Message: fmt.Sprintf("no found currboos:%d", info.Indexboos), } return } - // if conf, err = this.module.configure.getGameExpeditionBoosData(info.Currboos); err != nil { - // errdata = &pb.ErrorData{ - // Code: pb.ErrorCode_ConfigNoFound, - // Message: err.Error(), - // } - // return - // } - // if heros, err = this.module.ModuleHero.QueryCrossMultipleHeroinfo(req.Heros); err != nil { - // errdata = &pb.ErrorData{ - // Code: pb.ErrorCode_DBError, - // Message: err.Error(), - // } - // return - // } + if conf, err = this.module.configure.getGameExpeditionBoosData(boos.Boosid); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Message: err.Error(), + } + return + } + if heros, err = this.module.ModuleHero.QueryCrossMultipleHeroinfo(session.GetUserId(), req.Heros); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Message: err.Error(), + } + return + } member = &pb.DBExpeditionMember{ Uid: session.GetUserId(), Heros: req.Heros, Totalpower: 100, State: 1, } + condition = make([]int32, 4) + for _, v := range heros { + if hconf, err = this.module.ModuleTools.GetHeroConfig(v.HeroID); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Message: err.Error(), + } + return + } + + if len(conf.Race) == 2 { + if hconf.Race == conf.Race[0] { + condition[0]++ + } + } + if len(conf.Job) == 2 { + if hconf.Job == conf.Job[0] { + condition[1]++ + } + } + for _, v := range conf.Hid { + if hconf.Hid == v { + condition[2]++ + } + } + if len(conf.Color) == 2 { + if hconf.Color == conf.Color[0] { + condition[3]++ + } + } + member.Totalpower += v.Fightvalue + } + + if condition[0] >= conf.Race[1] { + addpwaer += conf.Fight + } + if condition[1] >= conf.Job[1] { + addpwaer += conf.Fight + } + if condition[2] >= int32(len(conf.Hid)) { + addpwaer += conf.Fight + } + if condition[3] >= conf.Color[1] { + addpwaer += conf.Fight + } + member.Totalpower = member.Totalpower + int32(math.Floor(float64(member.Totalpower)*float64(addpwaer)/float64(1000))) boos.Members[session.GetUserId()] = member - this.module.modelExpedition.updateGuildGve(info) + if err = this.module.model.updateExpedition(info); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Message: err.Error(), + } + return + } session.SendMsg(string(this.module.GetType()), "info", &pb.ExpeditionInfoResp{Info: info}) return } diff --git a/modules/expedition/core.go b/modules/expedition/core.go index 1b96b11eb..b07b337e1 100644 --- a/modules/expedition/core.go +++ b/modules/expedition/core.go @@ -1,5 +1,20 @@ package expedition +import "go_dreamfactory/sys/configure" + const ( UnionGveBoosCoonfKey = "UnionGveBoosCoonf" ) + +func getSysDayTimeState() (state int32) { + hour := configure.Now().Hour() + if hour < 10 { + return 0 + } else if hour < 20 { + return 1 + } else if hour < 21 { + return 2 + } else { + return 3 + } +} diff --git a/modules/expedition/modelExpedition.go b/modules/expedition/model.go similarity index 86% rename from modules/expedition/modelExpedition.go rename to modules/expedition/model.go index 261f6cd4a..34b29f38c 100644 --- a/modules/expedition/modelExpedition.go +++ b/modules/expedition/model.go @@ -60,10 +60,11 @@ func (this *ModelExpedition) getInfo(guildid string) (result *pb.DBExpedition, e return } result = &pb.DBExpedition{ - Guildid: guildid, - Lv: 1, - Refresh: configure.Now().Unix(), - Boos: make([]*pb.DBExpeditionBoos, 0), + Guildid: guildid, + Lv: 1, + Refresh: configure.Now().Unix(), + Indexboos: 0, + Boos: make([]*pb.DBExpeditionBoos, 0), } for _, v := range confs { result.Boos = append(result.Boos, &pb.DBExpeditionBoos{ @@ -72,15 +73,16 @@ func (this *ModelExpedition) getInfo(guildid string) (result *pb.DBExpedition, e Members: make(map[string]*pb.DBExpeditionMember), }) } - result.Currboos = result.Boos[0].Boosid err = this.Add(guildid, result) } return } -func (this *ModelExpedition) updateGuildGve(data *pb.DBExpedition) (err error) { +func (this *ModelExpedition) updateExpedition(data *pb.DBExpedition) (err error) { if err = this.ChangeById(data.Guildid, map[string]interface{}{ - "boos": data.Boos, + "lv": data.Lv, + "indexboos": data.Indexboos, + "boos": data.Boos, }); err != nil { this.module.Error("更新用户任务数据 错误!", log.Field{Key: "err", Value: err.Error()}) return @@ -104,7 +106,32 @@ func (this *ModelExpedition) refreshBoos(info *pb.DBExpedition) (conf *pb.DBGuil Members: make(map[string]*pb.DBExpeditionMember), }) } - info.Currboos = info.Boos[0].Boosid + info.Refresh = configure.Now().Unix() + info.Indexboos = 0 + return +} + +//结算boos +func (this *ModelExpedition) settlementboos(info *pb.DBExpedition, boos *pb.DBExpeditionBoos) (changed bool) { + var ( + fightingValue int32 + ) + if len(boos.Members) == 0 { + return + } + for _, v := range boos.Members { + fightingValue += v.Totalpower + } + boos.Hp -= fightingValue + if boos.Hp < 0 { + if info.Indexboos < int32(len(info.Boos))-1 { + info.Indexboos++ + } else { + info.Lv++ + } + } + boos.Crusaded = true + changed = true return } diff --git a/modules/expedition/module.go b/modules/expedition/module.go index 0193f512d..9bd2a1fd9 100644 --- a/modules/expedition/module.go +++ b/modules/expedition/module.go @@ -18,12 +18,12 @@ func NewModule() core.IModule { type Expedition struct { modules.ModuleBase - service comm.IService - sociaty comm.ISociaty - mail comm.Imail - api *apiComp - modelExpedition *ModelExpedition - configure *MCompConfigure + service comm.IService + sociaty comm.ISociaty + mail comm.Imail + api *apiComp + model *ModelExpedition + configure *MCompConfigure } // 模块名 @@ -60,7 +60,7 @@ func (this *Expedition) OnInstallComp() { this.ModuleBase.OnInstallComp() this.api = this.RegisterComp(new(apiComp)).(*apiComp) this.configure = this.RegisterComp(new(MCompConfigure)).(*MCompConfigure) - this.modelExpedition = this.RegisterComp(new(ModelExpedition)).(*ModelExpedition) + this.model = this.RegisterComp(new(ModelExpedition)).(*ModelExpedition) } // 红点 diff --git a/pb/expedition_db.pb.go b/pb/expedition_db.pb.go index bb23d9653..741ccfa08 100644 --- a/pb/expedition_db.pb.go +++ b/pb/expedition_db.pb.go @@ -26,11 +26,11 @@ type DBExpedition struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Guildid string `protobuf:"bytes,1,opt,name=guildid,proto3" json:"guildid" bson:"_id"` - Lv int32 `protobuf:"varint,2,opt,name=lv,proto3" json:"lv"` //当前第几阶段 - Refresh int64 `protobuf:"varint,3,opt,name=refresh,proto3" json:"refresh"` //最后刷新时间 - Currboos int32 `protobuf:"varint,4,opt,name=currboos,proto3" json:"currboos"` //当前boos - Boos []*DBExpeditionBoos `protobuf:"bytes,5,rep,name=boos,proto3" json:"boos"` //boos列表 + Guildid string `protobuf:"bytes,1,opt,name=guildid,proto3" json:"guildid" bson:"_id"` + Lv int32 `protobuf:"varint,2,opt,name=lv,proto3" json:"lv"` //当前第几阶段 + Refresh int64 `protobuf:"varint,3,opt,name=refresh,proto3" json:"refresh"` //最后刷新时间 + Indexboos int32 `protobuf:"varint,4,opt,name=indexboos,proto3" json:"indexboos"` //当前boos + Boos []*DBExpeditionBoos `protobuf:"bytes,5,rep,name=boos,proto3" json:"boos"` //boos列表 } func (x *DBExpedition) Reset() { @@ -86,9 +86,9 @@ func (x *DBExpedition) GetRefresh() int64 { return 0 } -func (x *DBExpedition) GetCurrboos() int32 { +func (x *DBExpedition) GetIndexboos() int32 { if x != nil { - return x.Currboos + return x.Indexboos } return 0 } @@ -105,9 +105,10 @@ type DBExpeditionBoos struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Boosid int32 `protobuf:"varint,1,opt,name=boosid,proto3" json:"boosid"` - Hp int32 `protobuf:"varint,2,opt,name=hp,proto3" json:"hp"` - Members map[string]*DBExpeditionMember `protobuf:"bytes,3,rep,name=members,proto3" json:"members" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Boosid int32 `protobuf:"varint,1,opt,name=boosid,proto3" json:"boosid"` + Hp int32 `protobuf:"varint,2,opt,name=hp,proto3" json:"hp"` + Crusaded bool `protobuf:"varint,3,opt,name=crusaded,proto3" json:"crusaded"` //是否讨伐完毕 + Members map[string]*DBExpeditionMember `protobuf:"bytes,4,rep,name=members,proto3" json:"members" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *DBExpeditionBoos) Reset() { @@ -156,6 +157,13 @@ func (x *DBExpeditionBoos) GetHp() int32 { return 0 } +func (x *DBExpeditionBoos) GetCrusaded() bool { + if x != nil { + return x.Crusaded + } + return false +} + func (x *DBExpeditionBoos) GetMembers() map[string]*DBExpeditionMember { if x != nil { return x.Members @@ -240,37 +248,39 @@ var File_expedition_expedition_db_proto protoreflect.FileDescriptor var file_expedition_expedition_db_proto_rawDesc = []byte{ 0x0a, 0x1e, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x95, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, + 0x22, 0x97, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x75, 0x69, 0x6c, 0x64, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x75, 0x69, 0x6c, 0x64, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x72, 0x65, - 0x66, 0x72, 0x65, 0x73, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x75, 0x72, 0x72, 0x62, 0x6f, 0x6f, - 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x75, 0x72, 0x72, 0x62, 0x6f, 0x6f, - 0x73, 0x12, 0x25, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x11, 0x2e, 0x44, 0x42, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x6f, - 0x6f, 0x73, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x73, 0x22, 0xc5, 0x01, 0x0a, 0x10, 0x44, 0x42, 0x45, - 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x6f, 0x6f, 0x73, 0x12, 0x16, 0x0a, - 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, - 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x68, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x02, 0x68, 0x70, 0x12, 0x38, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x44, 0x42, 0x45, 0x78, 0x70, 0x65, 0x64, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x6f, 0x6f, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x1a, - 0x4f, 0x0a, 0x0c, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x29, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x13, 0x2e, 0x44, 0x42, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x4d, - 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, - 0x22, 0x72, 0x0a, 0x12, 0x44, 0x42, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x68, 0x65, 0x72, 0x6f, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x12, 0x1e, - 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, - 0x74, 0x61, 0x74, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x66, 0x72, 0x65, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x62, 0x6f, + 0x6f, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x62, + 0x6f, 0x6f, 0x73, 0x12, 0x25, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x11, 0x2e, 0x44, 0x42, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x42, 0x6f, 0x6f, 0x73, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x73, 0x22, 0xe1, 0x01, 0x0a, 0x10, 0x44, + 0x42, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x6f, 0x6f, 0x73, 0x12, + 0x16, 0x0a, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x68, 0x70, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x02, 0x68, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x72, 0x75, 0x73, 0x61, + 0x64, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x63, 0x72, 0x75, 0x73, 0x61, + 0x64, 0x65, 0x64, 0x12, 0x38, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x44, 0x42, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x42, 0x6f, 0x6f, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x1a, 0x4f, 0x0a, + 0x0c, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x29, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, + 0x2e, 0x44, 0x42, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x72, + 0x0a, 0x12, 0x44, 0x42, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x12, 0x1e, 0x0a, 0x0a, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, + 0x74, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/pb/expedition_msg.pb.go b/pb/expedition_msg.pb.go index 22ee2907b..a1f3a32d7 100644 --- a/pb/expedition_msg.pb.go +++ b/pb/expedition_msg.pb.go @@ -73,7 +73,8 @@ type ExpeditionInfoResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Info *DBExpedition `protobuf:"bytes,1,opt,name=info,proto3" json:"info"` + Info *DBExpedition `protobuf:"bytes,1,opt,name=info,proto3" json:"info"` + State int32 `protobuf:"varint,2,opt,name=state,proto3" json:"state"` //0 未开放 1 准备中 2讨伐中 3结算中 } func (x *ExpeditionInfoResp) Reset() { @@ -115,6 +116,13 @@ func (x *ExpeditionInfoResp) GetInfo() *DBExpedition { return nil } +func (x *ExpeditionInfoResp) GetState() int32 { + if x != nil { + return x.State + } + return 0 +} + //上英雄 type ExpeditionUpHeroReq struct { state protoimpl.MessageState @@ -338,30 +346,32 @@ var file_expedition_expedition_msg_proto_rawDesc = []byte{ 0x6f, 0x1a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2d, 0x0a, 0x11, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x75, 0x69, 0x6c, 0x64, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x75, 0x69, 0x6c, 0x64, 0x69, 0x64, 0x22, 0x37, 0x0a, 0x12, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x75, 0x69, 0x6c, 0x64, 0x69, 0x64, 0x22, 0x4d, 0x0a, 0x12, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x45, 0x0a, 0x13, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x55, 0x70, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, - 0x67, 0x75, 0x69, 0x6c, 0x64, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, - 0x75, 0x69, 0x6c, 0x64, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x22, 0x43, 0x0a, 0x14, - 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x70, 0x48, 0x65, 0x72, 0x6f, - 0x52, 0x65, 0x73, 0x70, 0x12, 0x2b, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x44, 0x42, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, - 0x72, 0x22, 0x48, 0x0a, 0x14, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x75, 0x69, - 0x6c, 0x64, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x75, 0x69, 0x6c, - 0x64, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x22, 0x50, 0x0a, 0x15, 0x45, - 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x05, - 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, - 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x42, 0x06, 0x5a, - 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x45, 0x0a, 0x13, 0x45, + 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x70, 0x48, 0x65, 0x72, 0x6f, 0x52, + 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x75, 0x69, 0x6c, 0x64, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x75, 0x69, 0x6c, 0x64, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, + 0x68, 0x65, 0x72, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x68, 0x65, 0x72, + 0x6f, 0x73, 0x22, 0x43, 0x0a, 0x14, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x55, 0x70, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2b, 0x0a, 0x06, 0x6d, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x44, 0x42, 0x45, + 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, + 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x48, 0x0a, 0x14, 0x45, 0x78, 0x70, 0x65, 0x64, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, + 0x18, 0x0a, 0x07, 0x67, 0x75, 0x69, 0x6c, 0x64, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x67, 0x75, 0x69, 0x6c, 0x64, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f, 0x6f, + 0x73, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, + 0x64, 0x22, 0x50, 0x0a, 0x15, 0x45, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f, + 0x6f, 0x73, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x6f, 0x6f, 0x73, + 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x05, 0x61, 0x77, + 0x61, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var (