gm 主线调整

This commit is contained in:
meixiongfeng 2023-06-14 18:11:10 +08:00
parent 4f2660fabb
commit f44e853bbc
4 changed files with 58 additions and 6 deletions

View File

@ -22,7 +22,7 @@ import (
9bingo:season,10 赛季塔层数
10bingo:viking // 解锁维京所有难度
11bingo:hunting // 解锁狩猎所有难度
12bingo:mainline,1100104 // mainstage 关卡ID
12bingo:mainline,1100207 // mainstage 关卡ID
13bingo:moon,1 // 触发月之秘境
14bingo:arena,100 // 设置竞技场用户积分
15bingo:sociatyexp,100 // 设置工会经验

View File

@ -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)
}
}
}

View File

@ -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 { // 统计主线进度

View File

@ -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