GM 调整主线关卡记录扩展数据
This commit is contained in:
parent
2e53af390b
commit
e0901115be
@ -170,12 +170,12 @@ func (this *configureComp) GMGetPreStage(chapterID int32) (chapter []int32) {
|
||||
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)
|
||||
//if conf.ChapterType == curChapter.ChapterType {
|
||||
if chapterID == conf.Id {
|
||||
break
|
||||
}
|
||||
chapter = append(chapter, conf.Id)
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,6 +95,9 @@ func (this *Mline) CheckPoint(uid string) bool {
|
||||
// 参数 难度 + 章节id
|
||||
func (this *Mline) ModifyMlineDataByNanduID(session comm.IUserSession, id int32) (errdata *pb.ErrorData) {
|
||||
var del []string
|
||||
var newChapter []int32
|
||||
var _mp map[int32]int32
|
||||
_mp = make(map[int32]int32)
|
||||
connf, err := this.configure.GetMainStageConf(id)
|
||||
if err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
@ -120,7 +123,6 @@ func (this *Mline) ModifyMlineDataByNanduID(session comm.IUserSession, id int32)
|
||||
this.modelMline.cleanChapterDataById(session.GetUserId(), del...)
|
||||
|
||||
_data := this.configure.GetAllStageByChapterID(connf.Chapterid)
|
||||
|
||||
newData := &pb.DBMline{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: session.GetUserId(),
|
||||
@ -136,6 +138,16 @@ func (this *Mline) ModifyMlineDataByNanduID(session comm.IUserSession, id int32)
|
||||
newData.Star[v] = 7
|
||||
}
|
||||
}
|
||||
itype := this.configure.GetMainChapterConf(connf.Chapterid).ChapterType
|
||||
if _, ok := _mp[itype]; !ok {
|
||||
_mp[itype] = newData.StageId
|
||||
}
|
||||
for k, v := range _mp {
|
||||
if k == itype && v <= newData.StageId {
|
||||
_mp[itype] = newData.StageId
|
||||
}
|
||||
}
|
||||
newChapter = append(newChapter, connf.Chapterid) // 更新
|
||||
this.modelMline.addNewChapter(session.GetUserId(), newData)
|
||||
// 获取之前的章节数据
|
||||
for _, v := range this.configure.GMGetPreStage(connf.Chapterid) {
|
||||
@ -156,30 +168,21 @@ func (this *Mline) ModifyMlineDataByNanduID(session comm.IUserSession, id int32)
|
||||
newData.StageId = v
|
||||
}
|
||||
}
|
||||
itype := this.configure.GetMainChapterConf(v).ChapterType
|
||||
if _, ok := _mp[itype]; !ok {
|
||||
_mp[itype] = newData.StageId
|
||||
}
|
||||
for k, v := range _mp {
|
||||
if k == itype && v <= newData.StageId {
|
||||
_mp[itype] = newData.StageId
|
||||
}
|
||||
}
|
||||
newChapter = append(newChapter, v) // 更新
|
||||
this.modelMline.addNewChapter(session.GetUserId(), newData)
|
||||
}
|
||||
|
||||
// 修改扩展数据
|
||||
if rst, err := this.ModuleUser.GetUserExpand(session.GetUserId()); err == nil { // 统计主线进度
|
||||
_mp := rst.Mline
|
||||
var cType int32
|
||||
conf := this.configure.GetMainChapterConf(connf.Chapterid)
|
||||
if conf != nil {
|
||||
cType = conf.ChapterType
|
||||
}
|
||||
if _mp == nil {
|
||||
_mp = make(map[int32]int32, 1)
|
||||
_mp[cType] = id
|
||||
} else {
|
||||
if v, ok := _mp[cType]; ok {
|
||||
if v <= id {
|
||||
_mp[cType] = id
|
||||
}
|
||||
} else {
|
||||
_mp[cType] = id
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := this.ModuleUser.GetUserExpand(session.GetUserId()); err == nil { // 统计主线进度
|
||||
this.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
|
||||
"mline": _mp,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user