From f44e853bbcd99335c3cb57d15bc2967b94b0e9cf Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 14 Jun 2023 18:11:10 +0800 Subject: [PATCH] =?UTF-8?q?gm=20=E4=B8=BB=E7=BA=BF=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/gm/api_cmd.go | 2 +- modules/mline/comp_configure.go | 38 +++++++++++++++++++++++++++++--- modules/mline/module.go | 20 +++++++++++++++++ modules/pagoda/comp_configure.go | 4 ++-- 4 files changed, 58 insertions(+), 6 deletions(-) diff --git a/modules/gm/api_cmd.go b/modules/gm/api_cmd.go index 1c8641b3a..68af62b29 100644 --- a/modules/gm/api_cmd.go +++ b/modules/gm/api_cmd.go @@ -22,7 +22,7 @@ import ( 9、bingo:season,10 赛季塔层数 10、bingo:viking // 解锁维京所有难度 11、bingo:hunting // 解锁狩猎所有难度 -12、bingo:mainline,1100104 // mainstage 关卡ID +12、bingo:mainline,1100207 // mainstage 关卡ID 13、bingo:moon,1 // 触发月之秘境 14、bingo:arena,100 // 设置竞技场用户积分 15、bingo:sociatyexp,100 // 设置工会经验 diff --git a/modules/mline/comp_configure.go b/modules/mline/comp_configure.go index 079cf41a4..7866f2474 100644 --- a/modules/mline/comp_configure.go +++ b/modules/mline/comp_configure.go @@ -6,6 +6,7 @@ import ( "go_dreamfactory/modules" "go_dreamfactory/sys/configure" cfg "go_dreamfactory/sys/configure/structs" + "sync" ) const moduleName = "mline" @@ -19,6 +20,9 @@ const ( type configureComp struct { modules.MCompConfigure module *Mline + hlock sync.RWMutex + + _mapMilne map[int32][]int32 // key 章节id value cid } //组件初始化接口 @@ -31,6 +35,8 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp game_mainstarreward: cfg.NewGameMainStarreward, }) + configure.RegisterConfigure(game_mainstage, cfg.NewGameMainStage, this.LoadMlineStage) + this.GMGetPreStage(11002) return } @@ -136,13 +142,39 @@ func (this *configureComp) GetAllChapterID() (chapter []int32) { return } -// 红点用 获取所有类型为1 的小关ID func (this *configureComp) GetAllStageByChapterID(chapterID int32) (stage []int32) { + return this._mapMilne[chapterID] +} + +func (this *configureComp) LoadMlineStage() { if v, err := this.GetConfigure(game_mainstage); err == nil { if configure, ok := v.(*cfg.GameMainStage); ok { + this.hlock.Lock() + defer this.hlock.Unlock() + this._mapMilne = make(map[int32][]int32) for _, v1 := range configure.GetDataList() { - if v1.Episodetype == 1 { - stage = append(stage, v1.Id) + this._mapMilne[v1.Chapterid] = append(this._mapMilne[v1.Chapterid], v1.Id) + } + } + } + return +} + +// GM 专用 获取这个章节之前的所有章节信息 +func (this *configureComp) GMGetPreStage(chapterID int32) (chapter []int32) { + curChapter := this.GetMainChapterConf(chapterID) + if curChapter == nil { + return + } + + if v, err := this.GetConfigure(game_mainchapter); err == nil { + if configure, ok := v.(*cfg.GameMainChapter); ok { + for _, conf := range configure.GetDataList() { + if conf.ChapterType == curChapter.ChapterType { + if chapterID == conf.Id { + break + } + chapter = append(chapter, conf.Id) } } } diff --git a/modules/mline/module.go b/modules/mline/module.go index 701beedda..8b372883d 100644 --- a/modules/mline/module.go +++ b/modules/mline/module.go @@ -132,6 +132,26 @@ func (this *Mline) ModifyMlineDataByNanduID(session comm.IUserSession, id int32) } } this.modelMline.addNewChapter(session.GetUserId(), newData) + // 获取之前的章节数据 + for _, v := range this.configure.GMGetPreStage(connf.Chapterid) { + newData := &pb.DBMline{ + Id: primitive.NewObjectID().Hex(), + Uid: session.GetUserId(), + CType: connf.Episodetype, + ChapterId: connf.Chapterid, + StageId: id, + Star: map[int32]int32{}, + Award: map[int32]bool{}, + Ps: map[int32]int32{}, + } + _data := this.configure.GetAllStageByChapterID(v) + for _, v := range _data { + if v <= id { + newData.Star[v] = 3 + } + } + this.modelMline.addNewChapter(session.GetUserId(), newData) + } // 修改扩展数据 if rst, err := this.ModuleUser.GetUserExpand(session.GetUserId()); err == nil { // 统计主线进度 diff --git a/modules/pagoda/comp_configure.go b/modules/pagoda/comp_configure.go index 7f75f6180..912c8132a 100644 --- a/modules/pagoda/comp_configure.go +++ b/modules/pagoda/comp_configure.go @@ -38,7 +38,6 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp game_pagoda: cfg.NewGamePagoda, }) - this._checkType = make(map[int32][]*cfg.GamePassCheckData, 0) configure.RegisterConfigure(game_passcheck, cfg.NewGamePassCheck, this.LoadPassCheck) configure.RegisterConfigure(game_pagoda, cfg.NewGamePagoda, this.LoadPagoda) return @@ -138,6 +137,7 @@ func (this *configureComp) LoadPassCheck() { if configure, ok := v.(*cfg.GamePassCheck); ok { this.hlock.Lock() defer this.hlock.Unlock() + this._checkType = make(map[int32][]*cfg.GamePassCheckData, 0) for _, value := range configure.GetDataList() { this._checkType[value.PasscheckType] = append(this._checkType[value.PasscheckType], value) } @@ -168,9 +168,9 @@ func (this *configureComp) LoadPagoda() { var err error if v, err := this.GetConfigure(game_pagoda); err == nil { if configure, ok := v.(*cfg.GamePagoda); ok { - this._mapPagoda = make(map[int32]*cfg.GamePagodaData) this.hlock.Lock() defer this.hlock.Unlock() + this._mapPagoda = make(map[int32]*cfg.GamePagodaData) for _, value := range configure.GetDataList() { key := value.Tab<<16 + value.LayerNum this._mapPagoda[key] = value