From 5c0d1e38273a20328127026dac36f0c9dddf5603 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 6 Jan 2023 12:02:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E4=B8=BB=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 3 + modules/mline/api.go | 13 +-- modules/mline/api_challenge.go | 43 ++----- modules/mline/api_challengeover.go | 77 ++++--------- modules/mline/api_getReward.go | 49 +------- modules/mline/api_getlist.go | 27 ++--- modules/mline/comp_configure.go | 82 ++++++-------- modules/mline/model_mainline.go | 28 ++--- modules/mline/module.go | 173 ++++++----------------------- pb/mline_msg.pb.go | 120 ++++++++++++-------- pb/shop_db.pb.go | 80 +++++-------- 11 files changed, 236 insertions(+), 459 deletions(-) diff --git a/comm/const.go b/comm/const.go index 26a42aece..4b8ec3805 100644 --- a/comm/const.go +++ b/comm/const.go @@ -212,6 +212,9 @@ const ( // 自动战斗 TableAuto = "autoBattle" + + ///新主线数据表 + TableMline = "mline" ) //RPC服务接口定义处 diff --git a/modules/mline/api.go b/modules/mline/api.go index f73167d0d..eb35ad09c 100644 --- a/modules/mline/api.go +++ b/modules/mline/api.go @@ -6,23 +6,22 @@ import ( ) const ( - MainlineGetListResp = "getlist" - MainlineChallengeResp = "challenge" - MainlineChallengeOverResp = "challengeover" - MainlineGetRewardResp = "getreward" - MainlineNewChapterPush = "newchapter" + MlineGetListResp = "getlist" + MlineChallengeResp = "challenge" + MlineChallengeOverResp = "challengeover" + MlineGetRewardResp = "getreward" ) type apiComp struct { modules.MCompGate service core.IService - module *Mainline + module *Mline } //组件初始化接口 func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { err = this.MCompGate.Init(service, module, comp, options) - this.module = module.(*Mainline) + this.module = module.(*Mline) this.service = service return } diff --git a/modules/mline/api_challenge.go b/modules/mline/api_challenge.go index 1389590ae..8478e2b3c 100644 --- a/modules/mline/api_challenge.go +++ b/modules/mline/api_challenge.go @@ -9,16 +9,13 @@ import ( ) //参数校验 -func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.MainlineChallengeReq) (code pb.ErrorCode) { - if req.MainlineId == 0 || req.ChapterObj == "" || req.Leadpos >= 5 || len(req.Teamids) != 5 || req.Leadpos < 0 { - code = pb.ErrorCode_ReqParameterError - return - } +func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.MlineChallengeReq) (code pb.ErrorCode) { + return } ///挑战主线关卡 -func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MainlineChallengeReq) (code pb.ErrorCode, data proto.Message) { +func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallengeReq) (code pb.ErrorCode, data proto.Message) { var ( curChapter *pb.DBMainline // 当前章节信息 ps int32 @@ -30,27 +27,13 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MainlineChalle return // 参数校验失败直接返回 } // 校验关卡存不存在 - curChapter = this.module.modelMainline.getOneChapterInfo(session.GetUserId(), req.ChapterObj) - if curChapter == nil { - code = pb.ErrorCode_MainlineNotFound - return - } - node := this.module.configure.GetMainlineConfigData(int32(req.MainlineId), curChapter.Intensity) + node := this.module.configure.GetMainStageConf(req.StageId) if node == nil { // 配置文件校验 code = pb.ErrorCode_MainlineNotFindChapter return } - for _, v := range curChapter.BranchID { - if v == int32(req.MainlineId) { // 重复挑战 - code = pb.ErrorCode_MainlineNotFindChapter - return - } - if v == int32(req.MainlineId) { - break - } - } if curChapter.Ps != 0 { if code = this.module.ConsumeRes(session, node.PsMg, true); code != pb.ErrorCode_Success { // 扣1点 return @@ -80,7 +63,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MainlineChalle "ps": ps, } - err := this.module.modelMainline.modifyMainlineData(session.GetUserId(), curChapter.Id, update) + err := this.module.modelMline.modifyMlineData(session.GetUserId(), curChapter.Id, update) if err != nil { code = pb.ErrorCode_DBError return @@ -88,21 +71,17 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MainlineChalle } code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{ - Ptype: pb.PlayType_mainline, - Title: "", - Format: &pb.BattleFormation{ - Leadpos: req.Leadpos, - Format: req.Teamids, - }, + Ptype: pb.PlayType_mainline, + Title: "", + Format: req.Battle, Mformat: node.FormatList, }) if code != pb.ErrorCode_Success { return } - session.SendMsg(string(this.module.GetType()), MainlineChallengeResp, &pb.MainlineChallengeResp{ - Info: &pb.BattleInfo{Id: record.Id, Title: record.Title, Btype: record.Btype, Ptype: record.Ptype, RedCompId: record.RedCompId, Redflist: record.Redflist, BlueCompId: record.BlueCompId, Buleflist: record.Buleflist}, - ChapterObj: req.ChapterObj, - MainlineId: req.GetMainlineId(), + session.SendMsg(string(this.module.GetType()), MlineChallengeResp, &pb.MlineChallengeResp{ + Info: &pb.BattleInfo{Id: record.Id, Title: record.Title, Btype: record.Btype, Ptype: record.Ptype, RedCompId: record.RedCompId, Redflist: record.Redflist, BlueCompId: record.BlueCompId, Buleflist: record.Buleflist}, + StageId: req.StageId, }) return } diff --git a/modules/mline/api_challengeover.go b/modules/mline/api_challengeover.go index 24d0c548f..5683d7278 100644 --- a/modules/mline/api_challengeover.go +++ b/modules/mline/api_challengeover.go @@ -6,13 +6,12 @@ import ( cfg "go_dreamfactory/sys/configure/structs" - "go.mongodb.org/mongo-driver/bson/primitive" "google.golang.org/protobuf/proto" ) //参数校验 -func (this *apiComp) ChallengeOverCheck(session comm.IUserSession, req *pb.MainlineChallengeOverReq) (code pb.ErrorCode) { - if req.MainlineId == 0 { +func (this *apiComp) ChallengeOverCheck(session comm.IUserSession, req *pb.MlineChallengeOverReq) (code pb.ErrorCode) { + if req.StageId == 0 { code = pb.ErrorCode_ReqParameterError return } @@ -20,12 +19,11 @@ func (this *apiComp) ChallengeOverCheck(session comm.IUserSession, req *pb.Mainl } ///挑战主线关卡 -func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineChallengeOverReq) (code pb.ErrorCode, data proto.Message) { +func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChallengeOverReq) (code pb.ErrorCode, data proto.Message) { var ( - mainline *pb.DBMainline // 当前章节信息 + mainline *pb.DBMline // 当前章节信息 res []*cfg.Gameatn // 小章节奖励 isWin bool - user *pb.DBUser hero []string //新的英雄 newhero []string //新的英雄 ) @@ -37,23 +35,18 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh return // 参数校验失败直接返回 } // 校验关卡存不存在 - mainline = this.module.modelMainline.getOneChapterInfo(session.GetUserId(), req.ChapterObj) - if mainline == nil { - code = pb.ErrorCode_MainlineNotFound - return - } + // mainline = this.module.modelMline.getOneChapterInfo(session.GetUserId(), req.ChapterObj) + // if mainline == nil { + // code = pb.ErrorCode_MainlineNotFound + // return + // } - node := this.module.configure.GetMainlineConfigData(int32(req.MainlineId), mainline.Intensity) + node := this.module.configure.GetMainStageConf(req.StageId) if node == nil { // 配置文件校验 code = pb.ErrorCode_MainlineNotFindChapter return } - for _, v := range mainline.BranchID { - if v == int32(req.MainlineId) { // 重复挑战 - code = pb.ErrorCode_MainlineNotFindChapter - return - } - } + // 校验通过 code, isWin = this.module.battle.CheckBattleReport(session, req.Report) @@ -63,8 +56,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh if !isWin { // 战斗失败直接返回 // 返还 - mainline.Ps = 0 - this.module.modelMainline.modifyMainlineData(session.GetUserId(), mainline.Id, map[string]interface{}{ + //mainline.Ps = 0 + this.module.modelMline.modifyMlineData(session.GetUserId(), mainline.Id, map[string]interface{}{ "ps": 0, }) @@ -75,8 +68,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh return } - res = append(res, node.Award...) - for _, v := range node.Award { + res = append(res, node.Commonaward...) + for _, v := range node.Commonaward { if v.A == comm.HeroType { hero = append(hero, v.T) } @@ -89,47 +82,21 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh } } } - user = this.module.ModuleUser.GetUser(session.GetUserId()) - mainline.MainlineId = int32(req.MainlineId) - mainline.BranchID = append(mainline.BranchID, int32(req.MainlineId)) - mainline.Ps = 0 // 重置预扣体力 + mainline.StageId = req.StageId + //mainline.Ps = 0 // 重置预扣体力 update := map[string]interface{}{ - "mainlineId": req.MainlineId, - "chapterId": mainline.ChapterId, - "branchID": mainline.BranchID, - "ps": 0, + "stageId": mainline.StageId, } if node.Episodetype == comm.MainLineBoss { // 打完boss 设置领奖状态 update["awaredID"] = pb.AwaredType_TypeAvailable - mainline.AwaredID = pb.AwaredType_TypeAvailable + } - err := this.module.modelMainline.modifyMainlineData(session.GetUserId(), mainline.Id, update) + err := this.module.modelMline.modifyMlineData(session.GetUserId(), mainline.Id, update) if err != nil { code = pb.ErrorCode_DBError return } - if node.Episodetype == comm.MainLineBoss { // 挑战完成 boss关 - _data := &pb.DBMainline{} - conf := this.module.configure.GetMainlineChapter(mainline.ChapterId + 1) - _data.Id = primitive.NewObjectID().Hex() - _data.ChapterId = mainline.ChapterId + 1 - _data.Intensity = mainline.Intensity - if conf == nil { // 这里就是切换下一个难度了 - if mainline.Intensity < comm.MaxMainlineIntensity { - _data.Intensity = mainline.Intensity + 1 // 难度+1 - _data.ChapterId = 1 // 默认第一章节 - } - } - - _mData := make(map[string]interface{}, 0) - _data.Uid = session.GetUserId() - _mData[_data.Id] = _data - - this.module.modelMainline.addNewChapter(session.GetUserId(), _mData) - session.SendMsg(string(this.module.GetType()), MainlineNewChapterPush, &pb.MainlineNewChapterPush{Data: _data}) // 推送新的章节 - - } // 发奖 if code = this.module.DispenseRes(session, res, true); code != pb.ErrorCode_Success { this.module.Debugf("DispenseRes err:+%v", res) @@ -145,9 +112,9 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh } } - session.SendMsg(string(this.module.GetType()), MainlineChallengeOverResp, &pb.MainlineChallengeOverResp{Data: mainline, Newheros: newhero, Olv: user.Lv}) + session.SendMsg(string(this.module.GetType()), MlineChallengeOverResp, &pb.MlineChallengeOverResp{}) // 主线任务统计 Rtype60 this.module.ModuleRtask.SendToRtask(session, comm.Rtype60, 1) - this.module.ModuleRtask.SendToRtask(session, comm.Rtype61, int32(req.MainlineId)) + this.module.ModuleRtask.SendToRtask(session, comm.Rtype61, int32(req.StageId)) return } diff --git a/modules/mline/api_getReward.go b/modules/mline/api_getReward.go index 9e4c3d8bc..9cfa2f756 100644 --- a/modules/mline/api_getReward.go +++ b/modules/mline/api_getReward.go @@ -8,58 +8,15 @@ import ( ) //参数校验 -func (this *apiComp) GetRewardCheck(session comm.IUserSession, req *pb.MainlineGetRewardReq) (code pb.ErrorCode) { - if req.ChapterObj == "" { +func (this *apiComp) GetRewardCheck(session comm.IUserSession, req *pb.MlineGetRewardReq) (code pb.ErrorCode) { + if req.CId == 0 || req.Star == 0 { code = pb.ErrorCode_ReqParameterError } return } ///获取主线关卡信息 -func (this *apiComp) GetReward(session comm.IUserSession, req *pb.MainlineGetRewardReq) (code pb.ErrorCode, data proto.Message) { - rsp := &pb.MainlineGetRewardResp{} +func (this *apiComp) GetReward(session comm.IUserSession, req *pb.MlineGetRewardReq) (code pb.ErrorCode, data proto.Message) { - code = this.GetRewardCheck(session, req) - if code != pb.ErrorCode_Success { - return // 参数校验失败直接返回 - } - - _obj := this.module.modelMainline.getOneChapterInfo(session.GetUserId(), req.ChapterObj) - if _obj == nil { - code = pb.ErrorCode_DBError - return - } - if _obj.AwaredID == pb.AwaredType_TypeReceived { - code = pb.ErrorCode_MainlineRepeatReward // 重复领奖 - return - } - if _obj.AwaredID != pb.AwaredType_TypeAvailable { - code = pb.ErrorCode_MainlineCompleteReward // 通关才能领奖 - return - } - // 校验是不是通关了 - chaptConfig := this.module.configure.GetMainlineChapter(int32(_obj.ChapterId)) // 根据配置文件找 - if chaptConfig == nil { - code = pb.ErrorCode_ConfigNoFound - return - } - - _obj.AwaredID = pb.AwaredType_TypeReceived // 设置领奖标记 - update := map[string]interface{}{ - "awaredID": _obj.AwaredID, - } - // 发奖 - code = this.module.DispenseRes(session, chaptConfig.Award, true) - if code != pb.ErrorCode_Success { - return - } - err := this.module.modelMainline.modifyMainlineData(session.GetUserId(), _obj.Id, update) - if err != nil { - code = pb.ErrorCode_DBError - return - } - - rsp.Data = _obj - session.SendMsg(string(this.module.GetType()), MainlineGetRewardResp, rsp) return } diff --git a/modules/mline/api_getlist.go b/modules/mline/api_getlist.go index b581740fb..14c87744a 100644 --- a/modules/mline/api_getlist.go +++ b/modules/mline/api_getlist.go @@ -4,44 +4,35 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/pb" - "go.mongodb.org/mongo-driver/bson/primitive" "google.golang.org/protobuf/proto" ) //参数校验 -func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.MainlineGetListReq) (code pb.ErrorCode) { +func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.MlineGetListReq) (code pb.ErrorCode) { return } ///获取主线关卡信息 -func (this *apiComp) GetList(session comm.IUserSession, req *pb.MainlineGetListReq) (code pb.ErrorCode, data proto.Message) { - rsp := &pb.MainlineGetListResp{} +func (this *apiComp) GetList(session comm.IUserSession, req *pb.MlineGetListReq) (code pb.ErrorCode, data proto.Message) { + rsp := &pb.MlineGetListResp{} code = this.GetListCheck(session, req) if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 } - list, err := this.module.modelMainline.getMainlineList(session.GetUserId()) + list, err := this.module.modelMline.getMainlineList(session.GetUserId()) if err != nil { code = pb.ErrorCode_DBError return } - if len(list) == 0 { // 如果数量为0 则默认创建一条数据 - _data := &pb.DBMainline{} - _data.Id = primitive.NewObjectID().Hex() - _data.ChapterId = 1 // 默认第一章节 - _mData := make(map[string]interface{}, 0) - _data.Uid = session.GetUserId() - _data.Intensity = 1 // 难度1 - _mData[_data.Id] = _data - - this.module.modelMainline.addNewChapter(session.GetUserId(), _mData) - list = append(list, _data) + for _, v := range list { + if v.CType == req.CType { + rsp.Data = append(rsp.Data, v) + } } - rsp.Data = list - session.SendMsg(string(this.module.GetType()), MainlineGetListResp, &pb.MainlineGetListResp{Data: rsp.Data}) + session.SendMsg(string(this.module.GetType()), MlineGetListResp, rsp) return } diff --git a/modules/mline/comp_configure.go b/modules/mline/comp_configure.go index 9c722d0cd..2d5025d95 100644 --- a/modules/mline/comp_configure.go +++ b/modules/mline/comp_configure.go @@ -2,7 +2,6 @@ package mline import ( "go_dreamfactory/lego/core" - "go_dreamfactory/lego/sys/log" "go_dreamfactory/modules" "go_dreamfactory/sys/configure" cfg "go_dreamfactory/sys/configure/structs" @@ -10,83 +9,66 @@ import ( ) const ( - game_mainlinechapter = "game_mainlinechapter.json" - game_mainline = "game_mainline.json" + game_mainchapter = "game_mainchapter.json" + game_mainstage = "game_mainstage.json" + game_mainstarreward = "game_mainstarreward.json" ) ///配置管理基础组件 type configureComp struct { modules.MCompConfigure - module *Mainline - hlock sync.RWMutex - _mapMainline map[int64]*cfg.GameMainlineData + module *Mline + hlock sync.RWMutex } //组件初始化接口 func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { err = this.MCompConfigure.Init(service, module, comp, options) - this.module = module.(*Mainline) + this.module = module.(*Mline) err = this.LoadMultiConfigure(map[string]interface{}{ - game_mainlinechapter: cfg.NewGameMainlineChapter, + game_mainchapter: cfg.NewGameMainChapter, + game_mainstage: cfg.NewGameMainStage, + game_mainstarreward: cfg.NewGameMainStarreward, }) - this._mapMainline = make(map[int64]*cfg.GameMainlineData, 0) - configure.RegisterConfigure(game_mainline, cfg.NewGameMainline, this.GetMainline) return } -func (this *configureComp) GetMainline() { - if v, err := this.GetConfigure(game_mainline); err == nil { - if configure, ok := v.(*cfg.GameMainline); ok { - this.hlock.Lock() - defer this.hlock.Unlock() - for _, value := range configure.GetDataList() { - this._mapMainline[int64(value.Id<<16)+int64(value.Intensity)] = value - } - return - } - } else { - log.Errorf("get game_mainline conf err:%v", err) - } - return -} - -// id + intensity -func (this *configureComp) GetMainlineConfigData(id, intensity int32) *cfg.GameMainlineData { - return this._mapMainline[int64(id<<16)+int64(intensity)] -} - //读取配置数据 func (this *configureComp) GetConfigure(name string) (v interface{}, err error) { return configure.GetConfigure(name) } -func (this *configureComp) GetMainlineChapter(id int32) (data *cfg.GameMainlineChapterData) { - if v, err := this.GetConfigure(game_mainlinechapter); err != nil { - this.module.Errorf("get global conf err:%v", err) - return - } else { - var ( - configure *cfg.GameMainlineChapter - ok bool - ) - if configure, ok = v.(*cfg.GameMainlineChapter); !ok { - this.module.Errorf("%T no is *cfg.Game_MainlineChapterData", v) - return +func (this *configureComp) GetMainChapterConf(id int32) (data *cfg.GameMainChapterData) { + if v, err := this.GetConfigure(game_mainchapter); err == nil { + if configure, ok := v.(*cfg.GameMainChapter); ok { + return configure.Get(id) } + } + this.module.Errorf("GameMainChapterData conf not found key :%d", id) + return +} - data = configure.Get(int(id - 1)) +func (this *configureComp) GetMainStarRewardConf(boxId int32) (data []*cfg.GameMainStarrewardData) { + if v, err := this.GetConfigure(game_mainstarreward); err == nil { + if configure, ok := v.(*cfg.GameMainStarreward); ok { + for _, v1 := range configure.GetDataList() { + if v1.Boxid == boxId { + data = append(data, v1) + } + } + } } return } -// 获取章节数量 -func (this *configureComp) GetMaxMainlineChapter() int32 { - if v, err := this.GetConfigure(game_mainlinechapter); err == nil { - if configure, ok := v.(*cfg.GameMainlineChapter); ok { - return int32(len(configure.GetDataList())) +func (this *configureComp) GetMainStageConf(id int32) (data *cfg.GameMainStageData) { + if v, err := this.GetConfigure(game_mainstage); err == nil { + if configure, ok := v.(*cfg.GameMainStage); ok { + return configure.Get(id) } } - return 0 + this.module.Errorf("GameMainStageData conf not found key :%d", id) + return } diff --git a/modules/mline/model_mainline.go b/modules/mline/model_mainline.go index dfb29d4df..2b48bacc9 100644 --- a/modules/mline/model_mainline.go +++ b/modules/mline/model_mainline.go @@ -7,32 +7,32 @@ import ( "go_dreamfactory/pb" ) -type ModelMainline struct { +type ModelMline struct { modules.MCompModel - module *Mainline + module *Mline } -func (this *ModelMainline) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { - this.TableName = comm.TableMainline +func (this *ModelMline) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + this.TableName = comm.TableMline err = this.MCompModel.Init(service, module, comp, options) - this.module = module.(*Mainline) + this.module = module.(*Mline) return } // 获取章节信息 -func (this *ModelMainline) getMainlineList(uid string) (storys []*pb.DBMainline, err error) { - storys = make([]*pb.DBMainline, 0) - err = this.GetList(uid, &storys) +func (this *ModelMline) getMainlineList(uid string) (mLine []*pb.DBMline, err error) { + mLine = make([]*pb.DBMline, 0) + err = this.GetList(uid, &mLine) return } // 修改章节信息 -func (this *ModelMainline) modifyMainlineData(uid string, objid string, data map[string]interface{}) error { - return this.module.modelMainline.ChangeList(uid, objid, data) +func (this *ModelMline) modifyMlineData(uid string, objId string, data map[string]interface{}) error { + return this.module.modelMline.ChangeList(uid, objId, data) } // 增加新的章节数据 -func (this *ModelMainline) addNewChapter(uId string, data map[string]interface{}) (err error) { +func (this *ModelMline) addNewChapter(uId string, data map[string]interface{}) (err error) { if err = this.AddLists(uId, data); err != nil { this.module.Errorf("err:%v", err) @@ -42,9 +42,9 @@ func (this *ModelMainline) addNewChapter(uId string, data map[string]interface{} } // 获取指定章节数据 -func (this *ModelMainline) getOneChapterInfo(uid, obj string) *pb.DBMainline { +func (this *ModelMline) getOneChapterInfo(uid, obj string) *pb.DBMainline { data := &pb.DBMainline{} - err := this.module.modelMainline.GetListObj(uid, obj, data) + err := this.module.modelMline.GetListObj(uid, obj, data) if err != nil { this.module.Errorf("%v", err) return nil @@ -53,7 +53,7 @@ func (this *ModelMainline) getOneChapterInfo(uid, obj string) *pb.DBMainline { } // 增加新的章节数据 -func (this *ModelMainline) cleanChapter(uId string) (err error) { +func (this *ModelMline) cleanChapter(uId string) (err error) { if err = this.DelByUId(uId); err != nil { this.module.Errorf("err:%v", err) diff --git a/modules/mline/module.go b/modules/mline/module.go index bc5697b5b..52d93fc15 100644 --- a/modules/mline/module.go +++ b/modules/mline/module.go @@ -5,90 +5,50 @@ import ( "go_dreamfactory/lego/core" "go_dreamfactory/modules" "go_dreamfactory/pb" - "sort" - - "go.mongodb.org/mongo-driver/bson/primitive" ) -type Mainline struct { +type Mline struct { modules.ModuleBase - modelMainline *ModelMainline - service core.IService - api *apiComp - configure *configureComp - battle comm.IBattle + modelMline *ModelMline + service core.IService + api *apiComp + configure *configureComp + battle comm.IBattle } func NewModule() core.IModule { - return &Mainline{} + return &Mline{} } -func (this *Mainline) GetType() core.M_Modules { +func (this *Mline) GetType() core.M_Modules { return comm.ModuleMainline } -func (this *Mainline) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { +func (this *Mline) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { err = this.ModuleBase.Init(service, module, options) this.service = service return } -func (this *Mainline) OnInstallComp() { +func (this *Mline) OnInstallComp() { this.ModuleBase.OnInstallComp() this.api = this.RegisterComp(new(apiComp)).(*apiComp) - this.modelMainline = this.RegisterComp(new(ModelMainline)).(*ModelMainline) + this.modelMline = this.RegisterComp(new(ModelMline)).(*ModelMline) this.configure = this.RegisterComp(new(configureComp)).(*configureComp) } // 接口信息 给其他模块调用 用来修改主线关卡信息 -func (this *Mainline) ModifyMainlineData(uid string, id int32) (code pb.ErrorCode) { - - conf := this.configure.GetMainlineConfigData(id, 1) - list, err := this.modelMainline.getMainlineList(uid) - if err != nil { - code = pb.ErrorCode_DBError - return - } - for _, v := range list { - if v.ChapterId == conf.Chapter { - data := make(map[string]interface{}, 0) - data["mainlineId"] = id - data["chapterId"] = v.ChapterId - this.modelMainline.modifyMainlineData(uid, v.Id, data) - if err != nil { - code = pb.ErrorCode_DBError - } - - return - } - } - //add - _data := &pb.DBMainline{} - _data.Id = primitive.NewObjectID().Hex() - _data.ChapterId = conf.Chapter - _data.MainlineId = conf.Id - _mData := make(map[string]interface{}, 0) - _data.Uid = uid - _data.Intensity = 1 // 难度1 - _mData[_data.Id] = _data - - this.modelMainline.addNewChapter(uid, _mData) - return -} - -func (this *Mainline) GetUsermainLineData(uid string) (mainlineId int32) { - - _szData, err := this.modelMainline.getMainlineList(uid) - if err == nil { - sort.SliceStable(_szData, func(i, j int) bool { // 排序 - return _szData[i].ChapterId > _szData[j].ChapterId - }) - } +func (this *Mline) ModifyMainlineData(uid string, id int32) (code pb.ErrorCode) { return } -func (this *Mainline) Start() (err error) { +func (this *Mline) GetUsermainLineData(uid string) (mainlineId int32) { + + return +} + +func (this *Mline) Start() (err error) { err = this.ModuleBase.Start() var module core.IModule if module, err = this.service.GetModule(comm.ModuleBattle); err != nil { @@ -100,7 +60,7 @@ func (this *Mainline) Start() (err error) { } //红点查询 -func (this *Mainline) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { +func (this *Mline) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { reddot = make(map[comm.ReddotType]bool) for _, v := range rid { if v == comm.Reddot5 { @@ -112,90 +72,25 @@ func (this *Mainline) Reddot(session comm.IUserSession, rid ...comm.ReddotType) } // 红点检测 -func (this *Mainline) CheckPoint(uid string) bool { - list, err := this.modelMainline.getMainlineList(uid) - if err != nil { - return false - } - for _, v := range list { - conf := this.configure.GetMainlineChapter(v.ChapterId) - if conf == nil { - continue - } - if len(conf.Episode) != len(v.BranchID) { - return true - } - } +func (this *Mline) CheckPoint(uid string) bool { + // list, err := this.modelMainline.getMainlineList(uid) + // if err != nil { + // return false + // } + // for _, v := range list { + // conf := this.configure.GetMainlineChapter(v.ChapterId) + // if conf == nil { + // continue + // } + // if len(conf.Episode) != len(v.BranchID) { + // return true + // } + // } return false } // 参数 难度 + 关卡id -func (this *Mainline) ModifyMainlineDataByNanduID(uid string, nandu, id int32) (code pb.ErrorCode) { - - conf := this.configure.GetMainlineConfigData(id, nandu) - if conf == nil { - code = pb.ErrorCode_ConfigNoFound // 找不到配置 - return - } - // 已现在设置的为准 删除之前的所有数据 - this.modelMainline.cleanChapter(uid) - // 获取当前的章节数据 - jumpCap := conf.Chapter - // 先加所有难度小于1 的章节 - for ndIndex := 1; ndIndex <= int(nandu)-1; ndIndex++ { - max := this.configure.GetMaxMainlineChapter() - for i := 1; i <= int(max); i++ { - confCap := this.configure.GetMainlineChapter(int32(i)) - //_conf := this.configure.GetMainlineConfigData(int32(i), int32(ndIndex)) - _data := &pb.DBMainline{} - _data.Id = primitive.NewObjectID().Hex() - _data.ChapterId = int32(i) - _data.MainlineId = confCap.Id - _mData := make(map[string]interface{}, 0) - _data.Uid = uid - _data.Intensity = int32(ndIndex) // 难度1 - - for _, v := range confCap.Episode { - _data.BranchID = append(_data.BranchID, v) - } - - _mData[_data.Id] = _data - - this.modelMainline.addNewChapter(uid, _mData) - } - } - // 加当前难度 的章节数据 - for i := 1; i <= int(jumpCap-1); i++ { - confCap := this.configure.GetMainlineChapter(int32(i)) - _data := &pb.DBMainline{} - _data.Id = primitive.NewObjectID().Hex() - _data.ChapterId = int32(i) - _data.MainlineId = confCap.Id - _mData := make(map[string]interface{}, 0) - _data.Uid = uid - _data.Intensity = int32(nandu) // 难度1 - for _, v := range confCap.Episode { - _data.BranchID = append(_data.BranchID, v) - } - _mData[_data.Id] = _data - this.modelMainline.addNewChapter(uid, _mData) - } - // 加当前难度 当前章节的前置关卡数据 - _data := &pb.DBMainline{} - _data.Id = primitive.NewObjectID().Hex() - _data.ChapterId = conf.Chapter - _data.MainlineId = conf.Id - _mData := make(map[string]interface{}, 0) - _data.Uid = uid - _data.Intensity = int32(nandu) // 难度1 - confCap := this.configure.GetMainlineChapter(int32(conf.Chapter)) - for _, v := range confCap.Episode { - if v <= id { - _data.BranchID = append(_data.BranchID, v) - } - } - _mData[_data.Id] = _data - this.modelMainline.addNewChapter(uid, _mData) +func (this *Mline) ModifyMainlineDataByNanduID(uid string, nandu, id int32) (code pb.ErrorCode) { return } diff --git a/pb/mline_msg.pb.go b/pb/mline_msg.pb.go index e0db9ac34..528143fe4 100644 --- a/pb/mline_msg.pb.go +++ b/pb/mline_msg.pb.go @@ -177,7 +177,8 @@ type MlineGetRewardResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Data *DBMline `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` //当前章节信息 + Data *DBMline `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` //当前章节信息 + Reward []*UserAssets `protobuf:"bytes,2,rep,name=reward,proto3" json:"reward"` // 奖励 } func (x *MlineGetRewardResp) Reset() { @@ -219,6 +220,13 @@ func (x *MlineGetRewardResp) GetData() *DBMline { return nil } +func (x *MlineGetRewardResp) GetReward() []*UserAssets { + if x != nil { + return x.Reward + } + return nil +} + // 挑战关卡 type MlineChallengeReq struct { state protoimpl.MessageState @@ -391,7 +399,8 @@ type MlineChallengeOverResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Data *DBMline `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` //当前章节信息 + Data *DBMline `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` //当前章节信息 + Reward []*UserAssets `protobuf:"bytes,2,rep,name=reward,proto3" json:"reward"` // 奖励 } func (x *MlineChallengeOverResp) Reset() { @@ -433,6 +442,13 @@ func (x *MlineChallengeOverResp) GetData() *DBMline { return nil } +func (x *MlineChallengeOverResp) GetReward() []*UserAssets { + if x != nil { + return x.Reward + } + return nil +} + var File_mline_mline_msg_proto protoreflect.FileDescriptor var file_mline_mline_msg_proto_rawDesc = []byte{ @@ -440,40 +456,46 @@ var file_mline_mline_msg_proto_rawDesc = []byte{ 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x6d, 0x6c, 0x69, 0x6e, 0x65, 0x2f, 0x6d, 0x6c, 0x69, 0x6e, 0x65, 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, 0x27, 0x0a, 0x0f, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x47, - 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x54, 0x79, - 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x54, 0x79, 0x70, 0x65, 0x22, - 0x30, 0x0a, 0x10, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x08, 0x2e, 0x44, 0x42, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x22, 0x39, 0x0a, 0x11, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, - 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x61, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x74, 0x61, 0x72, 0x22, 0x32, 0x0a, 0x12, - 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x08, 0x2e, 0x44, 0x42, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x22, 0x57, 0x0a, 0x11, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, - 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x61, 0x67, 0x65, 0x49, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x74, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, - 0x28, 0x0a, 0x06, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x10, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x06, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x22, 0x4f, 0x0a, 0x12, 0x4d, 0x6c, 0x69, - 0x6e, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, - 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, - 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, - 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x61, 0x67, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x07, 0x73, 0x74, 0x61, 0x67, 0x65, 0x49, 0x64, 0x22, 0x58, 0x0a, 0x15, 0x4d, 0x6c, - 0x69, 0x6e, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x4f, 0x76, 0x65, 0x72, - 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x61, 0x67, 0x65, 0x49, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x74, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x25, 0x0a, - 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, - 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x06, 0x72, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x22, 0x36, 0x0a, 0x16, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x68, 0x61, - 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x27, 0x0a, 0x0f, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x47, 0x65, 0x74, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x54, 0x79, 0x70, 0x65, 0x22, 0x30, 0x0a, 0x10, 0x4d, + 0x6c, 0x69, 0x6e, 0x65, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x1c, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, + 0x44, 0x42, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x39, 0x0a, + 0x11, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, + 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x03, 0x63, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x61, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x04, 0x73, 0x74, 0x61, 0x72, 0x22, 0x57, 0x0a, 0x12, 0x4d, 0x6c, 0x69, 0x6e, + 0x65, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x44, - 0x42, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, - 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x42, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x23, 0x0a, 0x06, + 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, + 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, + 0x64, 0x22, 0x57, 0x0a, 0x11, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, + 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x61, 0x67, 0x65, 0x49, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x74, 0x61, 0x67, 0x65, 0x49, 0x64, + 0x12, 0x28, 0x0a, 0x06, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x10, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x06, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x22, 0x4f, 0x0a, 0x12, 0x4d, 0x6c, + 0x69, 0x6e, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, + 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, + 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x61, 0x67, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x07, 0x73, 0x74, 0x61, 0x67, 0x65, 0x49, 0x64, 0x22, 0x58, 0x0a, 0x15, 0x4d, + 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x4f, 0x76, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x61, 0x67, 0x65, 0x49, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x74, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x25, + 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x06, 0x72, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x5b, 0x0a, 0x16, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x68, + 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x1c, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, + 0x44, 0x42, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x23, 0x0a, + 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, + 0x55, 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x06, 0x72, 0x65, 0x77, 0x61, + 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -499,22 +521,25 @@ var file_mline_mline_msg_proto_goTypes = []interface{}{ (*MlineChallengeOverReq)(nil), // 6: MlineChallengeOverReq (*MlineChallengeOverResp)(nil), // 7: MlineChallengeOverResp (*DBMline)(nil), // 8: DBMline - (*BattleFormation)(nil), // 9: BattleFormation - (*BattleInfo)(nil), // 10: BattleInfo - (*BattleReport)(nil), // 11: BattleReport + (*UserAssets)(nil), // 9: UserAssets + (*BattleFormation)(nil), // 10: BattleFormation + (*BattleInfo)(nil), // 11: BattleInfo + (*BattleReport)(nil), // 12: BattleReport } var file_mline_mline_msg_proto_depIdxs = []int32{ 8, // 0: MlineGetListResp.data:type_name -> DBMline 8, // 1: MlineGetRewardResp.data:type_name -> DBMline - 9, // 2: MlineChallengeReq.battle:type_name -> BattleFormation - 10, // 3: MlineChallengeResp.info:type_name -> BattleInfo - 11, // 4: MlineChallengeOverReq.report:type_name -> BattleReport - 8, // 5: MlineChallengeOverResp.data:type_name -> DBMline - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 9, // 2: MlineGetRewardResp.reward:type_name -> UserAssets + 10, // 3: MlineChallengeReq.battle:type_name -> BattleFormation + 11, // 4: MlineChallengeResp.info:type_name -> BattleInfo + 12, // 5: MlineChallengeOverReq.report:type_name -> BattleReport + 8, // 6: MlineChallengeOverResp.data:type_name -> DBMline + 9, // 7: MlineChallengeOverResp.reward:type_name -> UserAssets + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_mline_mline_msg_proto_init() } @@ -524,6 +549,7 @@ func file_mline_mline_msg_proto_init() { } file_mline_mline_db_proto_init() file_battle_battle_msg_proto_init() + file_comm_proto_init() if !protoimpl.UnsafeEnabled { file_mline_mline_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MlineGetListReq); i { diff --git a/pb/shop_db.pb.go b/pb/shop_db.pb.go index 545b102ce..0f65996ac 100644 --- a/pb/shop_db.pb.go +++ b/pb/shop_db.pb.go @@ -162,15 +162,13 @@ type DBShop 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 - RefreshnumgoldShop int32 `protobuf:"varint,3,opt,name=refreshnumgoldShop,proto3" json:"refreshnumgoldShop" bson:"refresholdShop"` //刷新金币商店次数 - RefreshtimegoldShop int64 `protobuf:"varint,4,opt,name=refreshtimegoldShop,proto3" json:"refreshtimegoldShop" bson:"refresholdShop"` //刷新金币商店的时间 - GoldShop *UserShopData `protobuf:"bytes,5,opt,name=goldShop,proto3" json:"goldShop" bson:"goldShop"` //金币商店数据 - DiamondShop *UserShopData `protobuf:"bytes,6,opt,name=diamondShop,proto3" json:"diamondShop" bson:"diamondShop"` //金币商店数据 - PvpShop *UserShopData `protobuf:"bytes,7,opt,name=pvpShop,proto3" json:"pvpShop" bson:"pvpShop"` //金币商店数据 - PveShop *UserShopData `protobuf:"bytes,8,opt,name=pveShop,proto3" json:"pveShop" bson:"pveShop"` //金币商店数据 - AllianceShop *UserShopData `protobuf:"bytes,9,opt,name=allianceShop,proto3" json:"allianceShop" bson:"allianceShop"` //金币商店数据 + 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 + GoldShop *UserShopData `protobuf:"bytes,3,opt,name=goldShop,proto3" json:"goldShop" bson:"goldShop"` //金币商店数据 + DiamondShop *UserShopData `protobuf:"bytes,4,opt,name=diamondShop,proto3" json:"diamondShop" bson:"diamondShop"` //金币商店数据 + PvpShop *UserShopData `protobuf:"bytes,5,opt,name=pvpShop,proto3" json:"pvpShop" bson:"pvpShop"` //金币商店数据 + PveShop *UserShopData `protobuf:"bytes,6,opt,name=pveShop,proto3" json:"pveShop" bson:"pveShop"` //金币商店数据 + AllianceShop *UserShopData `protobuf:"bytes,7,opt,name=allianceShop,proto3" json:"allianceShop" bson:"allianceShop"` //金币商店数据 } func (x *DBShop) Reset() { @@ -219,20 +217,6 @@ func (x *DBShop) GetUid() string { return "" } -func (x *DBShop) GetRefreshnumgoldShop() int32 { - if x != nil { - return x.RefreshnumgoldShop - } - return 0 -} - -func (x *DBShop) GetRefreshtimegoldShop() int64 { - if x != nil { - return x.RefreshtimegoldShop - } - return 0 -} - func (x *DBShop) GetGoldShop() *UserShopData { if x != nil { return x.GoldShop @@ -296,37 +280,31 @@ var file_shop_shop_db_proto_rawDesc = []byte{ 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, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x22, 0xed, 0x02, 0x0a, 0x06, 0x44, 0x42, 0x53, 0x68, 0x6f, 0x70, 0x12, 0x0e, 0x0a, + 0x38, 0x01, 0x22, 0x8b, 0x02, 0x0a, 0x06, 0x44, 0x42, 0x53, 0x68, 0x6f, 0x70, 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, - 0x2e, 0x0a, 0x12, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x6e, 0x75, 0x6d, 0x67, 0x6f, 0x6c, - 0x64, 0x53, 0x68, 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x12, 0x72, 0x65, 0x66, - 0x72, 0x65, 0x73, 0x68, 0x6e, 0x75, 0x6d, 0x67, 0x6f, 0x6c, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x12, - 0x30, 0x0a, 0x13, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x74, 0x69, 0x6d, 0x65, 0x67, 0x6f, - 0x6c, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x13, 0x72, 0x65, - 0x66, 0x72, 0x65, 0x73, 0x68, 0x74, 0x69, 0x6d, 0x65, 0x67, 0x6f, 0x6c, 0x64, 0x53, 0x68, 0x6f, - 0x70, 0x12, 0x29, 0x0a, 0x08, 0x67, 0x6f, 0x6c, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x68, 0x6f, 0x70, 0x44, 0x61, - 0x74, 0x61, 0x52, 0x08, 0x67, 0x6f, 0x6c, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x12, 0x2f, 0x0a, 0x0b, - 0x64, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x29, 0x0a, 0x08, 0x67, 0x6f, 0x6c, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x68, 0x6f, 0x70, 0x44, 0x61, 0x74, 0x61, - 0x52, 0x0b, 0x64, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x12, 0x27, 0x0a, - 0x07, 0x70, 0x76, 0x70, 0x53, 0x68, 0x6f, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, - 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x68, 0x6f, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x70, - 0x76, 0x70, 0x53, 0x68, 0x6f, 0x70, 0x12, 0x27, 0x0a, 0x07, 0x70, 0x76, 0x65, 0x53, 0x68, 0x6f, - 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x68, - 0x6f, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x70, 0x76, 0x65, 0x53, 0x68, 0x6f, 0x70, 0x12, - 0x31, 0x0a, 0x0c, 0x61, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x68, 0x6f, 0x70, 0x18, - 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x68, 0x6f, 0x70, - 0x44, 0x61, 0x74, 0x61, 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x68, - 0x6f, 0x70, 0x2a, 0x5f, 0x0a, 0x08, 0x53, 0x68, 0x6f, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, - 0x0a, 0x04, 0x4e, 0x75, 0x6c, 0x6c, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x47, 0x6f, 0x6c, 0x64, - 0x53, 0x68, 0x6f, 0x70, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x69, 0x61, 0x6d, 0x6f, 0x6e, - 0x64, 0x53, 0x68, 0x6f, 0x70, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x56, 0x50, 0x53, 0x68, - 0x6f, 0x70, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x56, 0x45, 0x53, 0x68, 0x6f, 0x70, 0x10, - 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x41, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x68, 0x6f, - 0x70, 0x10, 0x05, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x52, 0x08, 0x67, 0x6f, 0x6c, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x12, 0x2f, 0x0a, 0x0b, 0x64, 0x69, + 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0d, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x68, 0x6f, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0b, + 0x64, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x12, 0x27, 0x0a, 0x07, 0x70, + 0x76, 0x70, 0x53, 0x68, 0x6f, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x55, + 0x73, 0x65, 0x72, 0x53, 0x68, 0x6f, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x70, 0x76, 0x70, + 0x53, 0x68, 0x6f, 0x70, 0x12, 0x27, 0x0a, 0x07, 0x70, 0x76, 0x65, 0x53, 0x68, 0x6f, 0x70, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x68, 0x6f, 0x70, + 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x70, 0x76, 0x65, 0x53, 0x68, 0x6f, 0x70, 0x12, 0x31, 0x0a, + 0x0c, 0x61, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x68, 0x6f, 0x70, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x68, 0x6f, 0x70, 0x44, 0x61, + 0x74, 0x61, 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x68, 0x6f, 0x70, + 0x2a, 0x5f, 0x0a, 0x08, 0x53, 0x68, 0x6f, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, + 0x4e, 0x75, 0x6c, 0x6c, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x47, 0x6f, 0x6c, 0x64, 0x53, 0x68, + 0x6f, 0x70, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x53, + 0x68, 0x6f, 0x70, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x56, 0x50, 0x53, 0x68, 0x6f, 0x70, + 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x56, 0x45, 0x53, 0x68, 0x6f, 0x70, 0x10, 0x04, 0x12, + 0x10, 0x0a, 0x0c, 0x41, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x68, 0x6f, 0x70, 0x10, + 0x05, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var (