GM 修改主线进度

This commit is contained in:
meixiongfeng 2023-01-17 16:24:33 +08:00
parent 1d2e7edd32
commit acc098c441
6 changed files with 43 additions and 61 deletions

View File

@ -156,7 +156,7 @@ type (
IReddot
}
IMline interface {
ModifyMlineDataByNanduID(uid string, nandu, id int32) (code pb.ErrorCode)
ModifyMlineDataByNanduID(session IUserSession, id int32) (code pb.ErrorCode)
/// 查询章节ID
GetUsermLineData(uid string, chapterType int32) (chapterId int32)
///红点

View File

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

View File

@ -194,8 +194,8 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
this.Debug("使用bingo命令:uid = %s ",
log.Field{Key: "uid", Value: session.GetUserId()},
log.Field{Key: "0", Value: datas[0]})
} else if len(datas) == 3 && (datas[0] == "mainline") {
module1, err := this.service.GetModule(comm.ModuleMainline)
} else if len(datas) == 2 && (datas[0] == "mainline") {
module1, err := this.service.GetModule(comm.ModuleMline)
if err != nil {
return
}
@ -204,12 +204,8 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
code = pb.ErrorCode_ReqParameterError
return
}
num2, err := strconv.Atoi(datas[2])
if err != nil {
code = pb.ErrorCode_ReqParameterError
return
}
code = module1.(comm.IMainline).ModifyMainlineDataByNanduID(session.GetUserId(), int32(num1), int32(num2))
code = module1.(comm.IMline).ModifyMlineDataByNanduID(session, int32(num1))
this.Debug("使用bingo命令",
log.Field{Key: "uid", Value: session.GetUserId()},

View File

@ -50,8 +50,8 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
}
for _, v := range list {
if preStageConf.CaptainId == v.ChapterId { // 有上一章节数据
if _, ok := v.Star[v.StageId]; ok {
if preStageConf.Chapterid == v.ChapterId { // 有上一章节数据
if _, ok := v.Star[preStageConf.Id]; ok {
newData := &pb.DBMline{
Id: primitive.NewObjectID().Hex(),
Uid: session.GetUserId(),
@ -62,22 +62,22 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
Award: map[int32]bool{},
Ps: map[int32]int32{},
}
curChapter = newData
this.module.modelMline.addNewChapter(session.GetUserId(), newData)
break
}
}
}
}
if curChapter == nil {
code = pb.ErrorCode_MainlineNotFindChapter
return
}
if v1, ok := curChapter.Ps[req.StageId]; ok && v1 == 0 {
if v, ok := curChapter.Ps[req.StageId]; ok && v > 0 {
if v != 0 { // 扣1点
if code = this.module.ConsumeRes(session, stageConf.PsMg, true); code != pb.ErrorCode_Success { // 扣1点
return
}
if code = this.module.ConsumeRes(session, stageConf.PsMg, true); code != pb.ErrorCode_Success { // 扣1点
return
}
} else {
for _, v := range stageConf.PsConsume {
if v.A == "attr" && v.T == "ps" {

View File

@ -140,24 +140,3 @@ func (this *configureComp) GetAllStageByChapterID(chapterID int32) (stage []int3
}
return
}
// gm 专用
func (this *configureComp) GetGMChapter(chapterID, itype int32) (d map[int32][]int32) {
// var d map[int32][]int32
d = make(map[int32][]int32, 0)
if v, err := this.GetConfigure(game_mainstage); err == nil {
if configure, ok := v.(*cfg.GameMainStage); ok {
for _, v1 := range configure.GetDataList() {
if v1.Episodetype == itype && v1.Id <= chapterID {
//chapter = append(chapter, v1.Id)
stage := this.GetAllStageByChapterID(v1.Id)
if len(stage) > 0 {
d[v1.Id] = stage
}
}
}
}
}
return
}

View File

@ -90,37 +90,44 @@ func (this *Mline) CheckPoint(uid string) bool {
}
// 参数 难度 + 章节id
func (this *Mline) ModifyMlineDataByNanduID(uid string, nandu, id int32) (code pb.ErrorCode) {
func (this *Mline) ModifyMlineDataByNanduID(session comm.IUserSession, id int32) (code pb.ErrorCode) {
var del []string
list, err := this.modelMline.getMainlineList(uid)
list, err := this.modelMline.getMainlineList(session.GetUserId())
if err != nil {
code = pb.ErrorCode_DBError
return
}
for _, v := range list {
if v.CType == nandu {
del = append(del, v.Id)
}
del = append(del, v.Id)
}
// 清除
this.modelMline.cleanChapterDataById(uid, del...)
d := this.configure.GetGMChapter(id, nandu)
for k, v := range d {
newData := &pb.DBMline{
Id: primitive.NewObjectID().Hex(),
Uid: uid,
CType: nandu,
ChapterId: k,
StageId: 0,
Star: map[int32]int32{},
Award: map[int32]bool{},
Ps: map[int32]int32{},
}
for _, v1 := range v {
newData.Star[v1] = 3 // gm 全给3星
}
this.modelMline.addNewChapter(uid, newData)
this.modelMline.cleanChapterDataById(session.GetUserId(), del...)
connf := this.configure.GetMainStageConf(id)
if connf == nil {
return
}
_data := this.configure.GetAllChapterID()
for _, v := range _data {
if v <= connf.Chapterid {
newData := &pb.DBMline{
Id: primitive.NewObjectID().Hex(),
Uid: session.GetUserId(),
CType: connf.Episodetype,
ChapterId: v,
StageId: id,
Star: map[int32]int32{},
Award: map[int32]bool{},
Ps: map[int32]int32{},
}
stageConf := this.configure.GetAllStageByChapterID(v)
for _, v := range stageConf {
newData.Star[v] = 3
}
this.modelMline.addNewChapter(session.GetUserId(), newData)
}
}
return
}
func (this *Mline) GetUsermLineData(uid string, chapterType int32) (chapterId int32) {