From f3262bca383a736fa8df7c538f5a94f409b7532d Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 20 Nov 2023 15:39:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=B5=B7=E5=B2=9B=E5=95=86?= =?UTF-8?q?=E5=BA=97=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/island/api_Info.go | 17 ++++ modules/island/api_buy.go | 62 +++++++++++++ modules/island/api_refresheroshop.go | 15 +++- modules/island/model.go | 1 + modules/island/modelhero.go | 25 +++++- modules/island/module.go | 5 ++ modules/shop/api_getlist.go | 2 +- pb/island_db.pb.go | 125 +++++++++++++++------------ pb/island_msg.pb.go | 72 ++++++++------- 9 files changed, 233 insertions(+), 91 deletions(-) diff --git a/modules/island/api_Info.go b/modules/island/api_Info.go index 2e80dba47..67692767f 100644 --- a/modules/island/api_Info.go +++ b/modules/island/api_Info.go @@ -16,6 +16,7 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.IsLandInfoReq) (err var ( info *pb.DBIsland heros []*pb.DBHero + cards []string err error ) if errdata = this.InfoCheck(session, req); errdata != nil { @@ -29,6 +30,22 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.IsLandInfoReq) (err } return } + if len(info.Heroshop) == 0 { + if cards, err = this.module.hero.GetRandomCardByCardPool(session.GetUserId(), 5); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Message: err.Error(), + } + return + } + for _, v := range cards { + info.Heroshop[v] = 0 + } + this.module.model.Change(session.GetUserId(), map[string]interface{}{ + "heroshop": info.Heroshop, + }) + } + if heros, err = this.module.modelhero.getHeroList(session.GetUserId()); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_DBError, diff --git a/modules/island/api_buy.go b/modules/island/api_buy.go index 44a5183f9..1edbc7838 100644 --- a/modules/island/api_buy.go +++ b/modules/island/api_buy.go @@ -3,6 +3,9 @@ package island import ( "go_dreamfactory/comm" "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" + + "go.mongodb.org/mongo-driver/bson/primitive" ) // 参数校验 @@ -14,14 +17,25 @@ func (this *apiComp) BuyCheck(session comm.IUserSession, req *pb.IsLandBuyReq) ( // /获取自己的排行榜信息 func (this *apiComp) Buy(session comm.IUserSession, req *pb.IsLandBuyReq) (errdata *pb.ErrorData) { var ( + conf *cfg.GameHeroData info *pb.DBIsland heros []*pb.DBHero + hero *pb.DBHero + ok bool err error ) if errdata = this.BuyCheck(session, req); errdata != nil { return } + if conf, err = this.module.ModuleTools.GetHeroConfig(req.Cids); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Message: err.Error(), + } + return + } + if info, err = this.module.model.getmodel(session.GetUserId()); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_DBError, @@ -29,6 +43,14 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.IsLandBuyReq) (errda } return } + if _, ok = info.Heroshop[req.Cids]; ok { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Message: "Purchased !", + } + return + } + info.Heroshop[req.Cids] = 1 if heros, err = this.module.modelhero.getHeroList(session.GetUserId()); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_DBError, @@ -36,6 +58,46 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.IsLandBuyReq) (errda } return } + + for _, v := range heros { + if v.HeroID == req.Cids { + hero = v + if hero.Star <= 6 { + hero.Star++ + hero.Lv = hero.Star * 10 + } else { + hero.JuexingLv++ + } + if hero.JuexingLv > 6 { //已满级不能购买 + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Message: "max lv!", + } + return + } + } + } + if hero == nil { + hero = &pb.DBHero{ + Id: primitive.NewObjectID().Hex(), + Uid: session.GetUserId(), + HeroID: conf.Hid, + Star: conf.Star, + Lv: conf.Star * 10, + Property: make(map[string]int32), + AddProperty: make(map[string]int32), + JuexProperty: make(map[string]int32), + } + this.module.hero.GetVirtualHero(hero, hero.Lv) + this.module.modelhero.addheros(session.GetUserId(), hero) + } else { + this.module.hero.GetVirtualHero(hero, hero.Lv) + this.module.modelhero.updateHeroProperty(session.GetUserId(), hero) + } + + this.module.model.Change(session.GetUserId(), map[string]interface{}{ + "heroshop": info.Heroshop, + }) session.SendMsg(string(this.module.GetType()), "info", &pb.IsLandInfoResp{Info: info, Heros: heros}) return } diff --git a/modules/island/api_refresheroshop.go b/modules/island/api_refresheroshop.go index 0a02b181d..aa5476dbc 100644 --- a/modules/island/api_refresheroshop.go +++ b/modules/island/api_refresheroshop.go @@ -15,7 +15,7 @@ func (this *apiComp) RefreshHeroShopCheck(session comm.IUserSession, req *pb.IsL func (this *apiComp) RefreshHeroShop(session comm.IUserSession, req *pb.IsLandRefresHeroShopReq) (errdata *pb.ErrorData) { var ( info *pb.DBIsland - heros []*pb.DBHero + cards []string err error ) if errdata = this.RefreshHeroShopCheck(session, req); errdata != nil { @@ -29,13 +29,22 @@ func (this *apiComp) RefreshHeroShop(session comm.IUserSession, req *pb.IsLandRe } return } - if heros, err = this.module.modelhero.getHeroList(session.GetUserId()); err != nil { + info.Refreshed++ + if cards, err = this.module.hero.GetRandomCardByCardPool(session.GetUserId(), 5); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_DBError, Message: err.Error(), } return } - session.SendMsg(string(this.module.GetType()), "info", &pb.IsLandInfoResp{Info: info, Heros: heros}) + info.Heroshop = make(map[string]int32) + for _, v := range cards { + info.Heroshop[v] = 0 + } + this.module.model.Change(session.GetUserId(), map[string]interface{}{ + "heroshop": info.Heroshop, + "refreshed": info.Refreshed, + }) + session.SendMsg(string(this.module.GetType()), "info", &pb.IsLandRefresHeroShopResp{Refreshed: info.Refreshed, Heroshop: cards}) return } diff --git a/modules/island/model.go b/modules/island/model.go index 8447f2c49..e629ea0ab 100644 --- a/modules/island/model.go +++ b/modules/island/model.go @@ -41,6 +41,7 @@ func (this *modelComp) getmodel(uid string) (result *pb.DBIsland, err error) { Id: primitive.NewObjectID().Hex(), Uid: uid, Opentime: utils.GetMonthStart(), + Heroshop: make(map[string]int32), Islands: make(map[int32]*pb.DBIslandItem), Nodes: make(map[int32]int32), } diff --git a/modules/island/modelhero.go b/modules/island/modelhero.go index f09ecb4cd..4a96b00de 100644 --- a/modules/island/modelhero.go +++ b/modules/island/modelhero.go @@ -36,10 +36,31 @@ func (this *modelHeroComp) getHeroList(uid string) (heros []*pb.DBHero, err erro // 获取玩家的英雄 func (this *modelHeroComp) getHeros(uid string, ids []string) (heros []*pb.DBHero, err error) { heros = make([]*pb.DBHero, 0) - err = this.GetListObjs(uid, ids, &heros) + if err = this.GetListObjs(uid, ids, &heros); err != nil { + this.module.Errorln(err) + } return } -func (this *modelHeroComp) addheros(heros *pb.DBHero) (err error) { +//添加英雄 +func (this *modelHeroComp) addheros(uid string, heros *pb.DBHero) (err error) { + if err = this.AddLists(uid, heros); err != nil { + this.module.Errorln(err) + } + return +} + +// 重新计算英雄属性 +func (this *modelHeroComp) updateHeroProperty(uid string, hero *pb.DBHero) (err error) { + update := map[string]interface{}{ + "star": hero.Star, + "juexingLv": hero.JuexingLv, + "property": hero.Property, + "juexProperty": hero.JuexProperty, + } + if err = this.ChangeList(uid, hero.Id, update); err != nil { + this.module.Errorln(err) + return + } return } diff --git a/modules/island/module.go b/modules/island/module.go index abf3f2938..ddc134495 100644 --- a/modules/island/module.go +++ b/modules/island/module.go @@ -20,6 +20,7 @@ func NewModule() core.IModule { type IsLand struct { modules.ModuleBase service base.IRPCXService + hero comm.IHero battle comm.IBattle api *apiComp model *modelComp @@ -52,6 +53,10 @@ func (this *IsLand) Start() (err error) { return } var module core.IModule + if module, err = this.service.GetModule(comm.ModuleHero); err != nil { + return + } + this.hero = module.(comm.IHero) if module, err = this.service.GetModule(comm.ModuleBattle); err != nil { return } diff --git a/modules/shop/api_getlist.go b/modules/shop/api_getlist.go index 5cb5a7a01..367564583 100644 --- a/modules/shop/api_getlist.go +++ b/modules/shop/api_getlist.go @@ -84,7 +84,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq) tdata = configure.Now().Sub((time.Unix(sdata.LastRefreshTime, 0))) switch shopconf.Rtype { case -1: //一百年不刷新 - ltime = 365 * 100 * 24 * time.Hour + ltime = 365 * 20 * 24 * time.Hour case 1: ltime = time.Hour * time.Duration(shopconf.Rtime) break diff --git a/pb/island_db.pb.go b/pb/island_db.pb.go index 6029c0dae..986afada6 100644 --- a/pb/island_db.pb.go +++ b/pb/island_db.pb.go @@ -27,13 +27,14 @@ type DBIsland struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` - Opentime int64 `protobuf:"varint,3,opt,name=opentime,proto3" json:"opentime"` //开启时间 - Heroshop []int32 `protobuf:"varint,4,rep,packed,name=heroshop,proto3" json:"heroshop"` //英雄商店 - Islands map[int32]*DBIslandItem `protobuf:"bytes,5,rep,name=islands,proto3" json:"islands" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` //岛屿 - Nodes map[int32]int32 `protobuf:"bytes,6,rep,name=nodes,proto3" json:"nodes" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //养成节点 - Freeprogress int32 `protobuf:"varint,7,opt,name=freeprogress,proto3" json:"freeprogress"` //已领取天数 + Opentime int64 `protobuf:"varint,3,opt,name=opentime,proto3" json:"opentime"` //开启时间 + Heroshop map[string]int32 `protobuf:"bytes,4,rep,name=heroshop,proto3" json:"heroshop" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //英雄商店 + Islands map[int32]*DBIslandItem `protobuf:"bytes,5,rep,name=islands,proto3" json:"islands" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` //岛屿 + Nodes map[int32]int32 `protobuf:"bytes,6,rep,name=nodes,proto3" json:"nodes" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //养成节点 + Freeprogress int32 `protobuf:"varint,7,opt,name=freeprogress,proto3" json:"freeprogress"` //已领取天数 Payprogress int32 `protobuf:"varint,8,opt,name=payprogress,proto3" json:"payprogress"` Vip bool `protobuf:"varint,9,opt,name=vip,proto3" json:"vip"` + Refreshed int32 `protobuf:"varint,10,opt,name=refreshed,proto3" json:"refreshed"` //已刷新 } func (x *DBIsland) Reset() { @@ -89,7 +90,7 @@ func (x *DBIsland) GetOpentime() int64 { return 0 } -func (x *DBIsland) GetHeroshop() []int32 { +func (x *DBIsland) GetHeroshop() map[string]int32 { if x != nil { return x.Heroshop } @@ -131,6 +132,13 @@ func (x *DBIsland) GetVip() bool { return false } +func (x *DBIsland) GetRefreshed() int32 { + if x != nil { + return x.Refreshed + } + return 0 +} + //海岛地图 type DBIslandItem struct { state protoimpl.MessageState @@ -199,44 +207,51 @@ var File_island_island_db_proto protoreflect.FileDescriptor var file_island_island_db_proto_rawDesc = []byte{ 0x0a, 0x16, 0x69, 0x73, 0x6c, 0x61, 0x6e, 0x64, 0x2f, 0x69, 0x73, 0x6c, 0x61, 0x6e, 0x64, 0x5f, - 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9f, 0x03, 0x0a, 0x08, 0x44, 0x42, 0x49, + 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x93, 0x04, 0x0a, 0x08, 0x44, 0x42, 0x49, 0x73, 0x6c, 0x61, 0x6e, 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, 0x1a, 0x0a, 0x08, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x70, 0x65, 0x6e, 0x74, - 0x69, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x18, - 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x12, - 0x30, 0x0a, 0x07, 0x69, 0x73, 0x6c, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x16, 0x2e, 0x44, 0x42, 0x49, 0x73, 0x6c, 0x61, 0x6e, 0x64, 0x2e, 0x49, 0x73, 0x6c, 0x61, - 0x6e, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x69, 0x73, 0x6c, 0x61, 0x6e, 0x64, - 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x44, 0x42, 0x49, 0x73, 0x6c, 0x61, 0x6e, 0x64, 0x2e, 0x4e, 0x6f, 0x64, 0x65, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x22, 0x0a, - 0x0c, 0x66, 0x72, 0x65, 0x65, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x0c, 0x66, 0x72, 0x65, 0x65, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, - 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x61, 0x79, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x70, 0x61, 0x79, 0x70, 0x72, 0x6f, 0x67, 0x72, - 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x69, 0x70, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x03, 0x76, 0x69, 0x70, 0x1a, 0x49, 0x0a, 0x0c, 0x49, 0x73, 0x6c, 0x61, 0x6e, 0x64, 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, 0x23, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x49, 0x73, 0x6c, 0x61, 0x6e, - 0x64, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, - 0x1a, 0x38, 0x0a, 0x0a, 0x4e, 0x6f, 0x64, 0x65, 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, 0x22, 0x9a, 0x01, 0x0a, 0x0c, 0x44, - 0x42, 0x49, 0x73, 0x6c, 0x61, 0x6e, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2e, 0x0a, 0x05, 0x6c, - 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x44, 0x42, 0x49, - 0x73, 0x6c, 0x61, 0x6e, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x70, - 0x6f, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x70, 0x6f, 0x73, 0x1a, 0x38, 0x0a, - 0x0a, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6d, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x44, 0x42, 0x49, 0x73, 0x6c, 0x61, 0x6e, 0x64, + 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, + 0x68, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x12, 0x30, 0x0a, 0x07, 0x69, 0x73, 0x6c, 0x61, + 0x6e, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x44, 0x42, 0x49, 0x73, + 0x6c, 0x61, 0x6e, 0x64, 0x2e, 0x49, 0x73, 0x6c, 0x61, 0x6e, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x07, 0x69, 0x73, 0x6c, 0x61, 0x6e, 0x64, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x6e, 0x6f, + 0x64, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x49, 0x73, + 0x6c, 0x61, 0x6e, 0x64, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x66, 0x72, 0x65, 0x65, 0x70, 0x72, + 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x66, 0x72, + 0x65, 0x65, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x61, + 0x79, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x0b, 0x70, 0x61, 0x79, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, + 0x76, 0x69, 0x70, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x76, 0x69, 0x70, 0x12, 0x1c, + 0x0a, 0x09, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x09, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x65, 0x64, 0x1a, 0x3b, 0x0a, 0x0d, + 0x48, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x70, 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, 0x49, 0x0a, 0x0c, 0x49, 0x73, 0x6c, + 0x61, 0x6e, 0x64, 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, 0x23, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x49, + 0x73, 0x6c, 0x61, 0x6e, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x4e, 0x6f, 0x64, 0x65, 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, 0x22, 0x9a, + 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x49, 0x73, 0x6c, 0x61, 0x6e, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x2e, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x44, 0x42, 0x49, 0x73, 0x6c, 0x61, 0x6e, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x65, + 0x76, 0x65, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, + 0x10, 0x0a, 0x03, 0x70, 0x6f, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x70, 0x6f, + 0x73, 0x1a, 0x38, 0x0a, 0x0a, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, + 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -251,24 +266,26 @@ func file_island_island_db_proto_rawDescGZIP() []byte { return file_island_island_db_proto_rawDescData } -var file_island_island_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_island_island_db_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_island_island_db_proto_goTypes = []interface{}{ (*DBIsland)(nil), // 0: DBIsland (*DBIslandItem)(nil), // 1: DBIslandItem - nil, // 2: DBIsland.IslandsEntry - nil, // 3: DBIsland.NodesEntry - nil, // 4: DBIslandItem.LevelEntry + nil, // 2: DBIsland.HeroshopEntry + nil, // 3: DBIsland.IslandsEntry + nil, // 4: DBIsland.NodesEntry + nil, // 5: DBIslandItem.LevelEntry } var file_island_island_db_proto_depIdxs = []int32{ - 2, // 0: DBIsland.islands:type_name -> DBIsland.IslandsEntry - 3, // 1: DBIsland.nodes:type_name -> DBIsland.NodesEntry - 4, // 2: DBIslandItem.level:type_name -> DBIslandItem.LevelEntry - 1, // 3: DBIsland.IslandsEntry.value:type_name -> DBIslandItem - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 2, // 0: DBIsland.heroshop:type_name -> DBIsland.HeroshopEntry + 3, // 1: DBIsland.islands:type_name -> DBIsland.IslandsEntry + 4, // 2: DBIsland.nodes:type_name -> DBIsland.NodesEntry + 5, // 3: DBIslandItem.level:type_name -> DBIslandItem.LevelEntry + 1, // 4: DBIsland.IslandsEntry.value:type_name -> DBIslandItem + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_island_island_db_proto_init() } @@ -308,7 +325,7 @@ func file_island_island_db_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_island_island_db_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 6, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/island_msg.pb.go b/pb/island_msg.pb.go index 50846fd93..1909df845 100644 --- a/pb/island_msg.pb.go +++ b/pb/island_msg.pb.go @@ -406,7 +406,8 @@ type IsLandRefresHeroShopResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Heroshop []int32 `protobuf:"varint,1,rep,packed,name=heroshop,proto3" json:"heroshop"` //英雄商店 + Refreshed int32 `protobuf:"varint,1,opt,name=refreshed,proto3" json:"refreshed"` //已刷新 + Heroshop []string `protobuf:"bytes,2,rep,name=heroshop,proto3" json:"heroshop"` //英雄商店 } func (x *IsLandRefresHeroShopResp) Reset() { @@ -441,7 +442,14 @@ func (*IsLandRefresHeroShopResp) Descriptor() ([]byte, []int) { return file_island_island_msg_proto_rawDescGZIP(), []int{7} } -func (x *IsLandRefresHeroShopResp) GetHeroshop() []int32 { +func (x *IsLandRefresHeroShopResp) GetRefreshed() int32 { + if x != nil { + return x.Refreshed + } + return 0 +} + +func (x *IsLandRefresHeroShopResp) GetHeroshop() []string { if x != nil { return x.Heroshop } @@ -454,7 +462,7 @@ type IsLandBuyReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Cids []int32 `protobuf:"varint,1,rep,packed,name=cids,proto3" json:"cids"` + Cids string `protobuf:"bytes,1,opt,name=cids,proto3" json:"cids"` } func (x *IsLandBuyReq) Reset() { @@ -489,11 +497,11 @@ func (*IsLandBuyReq) Descriptor() ([]byte, []int) { return file_island_island_msg_proto_rawDescGZIP(), []int{8} } -func (x *IsLandBuyReq) GetCids() []int32 { +func (x *IsLandBuyReq) GetCids() string { if x != nil { return x.Cids } - return nil + return "" } //购买英雄卡回应 @@ -502,7 +510,7 @@ type IsLandBuyResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Award []*UserAtno `protobuf:"bytes,1,rep,name=award,proto3" json:"award"` //奖励 + Hero *DBHero `protobuf:"bytes,1,opt,name=hero,proto3" json:"hero"` //奖励 } func (x *IsLandBuyResp) Reset() { @@ -537,9 +545,9 @@ func (*IsLandBuyResp) Descriptor() ([]byte, []int) { return file_island_island_msg_proto_rawDescGZIP(), []int{9} } -func (x *IsLandBuyResp) GetAward() []*UserAtno { +func (x *IsLandBuyResp) GetHero() *DBHero { if x != nil { - return x.Award + return x.Hero } return nil } @@ -783,29 +791,31 @@ var file_island_island_msg_proto_rawDesc = []byte{ 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, 0x22, 0x19, 0x0a, 0x17, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x48, 0x65, - 0x72, 0x6f, 0x53, 0x68, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x22, 0x36, 0x0a, 0x18, 0x49, 0x73, 0x4c, + 0x72, 0x6f, 0x53, 0x68, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x22, 0x54, 0x0a, 0x18, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x68, 0x6f, - 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, - 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, - 0x70, 0x22, 0x22, 0x0a, 0x0c, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x42, 0x75, 0x79, 0x52, 0x65, - 0x71, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, - 0x04, 0x63, 0x69, 0x64, 0x73, 0x22, 0x30, 0x0a, 0x0d, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x42, - 0x75, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, - 0x52, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x22, 0x24, 0x0a, 0x10, 0x49, 0x73, 0x4c, 0x61, 0x6e, - 0x64, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x6e, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6e, 0x69, 0x64, 0x22, 0x35, 0x0a, - 0x11, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x03, 0x6e, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x02, 0x6c, 0x76, 0x22, 0x12, 0x0a, 0x10, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x52, 0x65, - 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x22, 0x53, 0x0a, 0x11, 0x49, 0x73, 0x4c, 0x61, - 0x6e, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, - 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, - 0x49, 0x73, 0x6c, 0x61, 0x6e, 0x64, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x1f, 0x0a, 0x05, - 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x04, 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, + 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, + 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, + 0x68, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x22, + 0x22, 0x0a, 0x0c, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x42, 0x75, 0x79, 0x52, 0x65, 0x71, 0x12, + 0x12, 0x0a, 0x04, 0x63, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, + 0x69, 0x64, 0x73, 0x22, 0x2c, 0x0a, 0x0d, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x42, 0x75, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, + 0x6f, 0x22, 0x24, 0x0a, 0x10, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x55, 0x70, 0x67, 0x72, 0x61, + 0x64, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x03, 0x6e, 0x69, 0x64, 0x22, 0x35, 0x0a, 0x11, 0x49, 0x73, 0x4c, 0x61, 0x6e, + 0x64, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, + 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6e, 0x69, 0x64, 0x12, 0x0e, + 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x22, 0x12, + 0x0a, 0x10, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, + 0x65, 0x71, 0x22, 0x53, 0x0a, 0x11, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x63, 0x65, + 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x49, 0x73, 0x6c, 0x61, 0x6e, 0x64, + 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x1f, 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, + 0x04, 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 ( @@ -850,7 +860,7 @@ var file_island_island_msg_proto_depIdxs = []int32{ 17, // 3: IsLandBattleResp.info:type_name -> BattleInfo 18, // 4: IsLandCompleteReq.report:type_name -> BattleReport 19, // 5: IsLandCompleteResp.award:type_name -> UserAtno - 19, // 6: IsLandBuyResp.award:type_name -> UserAtno + 15, // 6: IsLandBuyResp.hero:type_name -> DBHero 14, // 7: IsLandReceiveResp.info:type_name -> DBIsland 19, // 8: IsLandReceiveResp.award:type_name -> UserAtno 9, // [9:9] is the sub-list for method output_type