支线剧情日志
This commit is contained in:
parent
af3ce8f4e8
commit
77e57cbd47
@ -32,6 +32,7 @@ func (this *ModelLinestory) getLinestory(uid string) *pb.DBLinestory {
|
||||
if err := this.Get(uid, ls); err != nil {
|
||||
if err == mongo.ErrNoDocuments {
|
||||
ls.Id = primitive.NewObjectID().Hex()
|
||||
|
||||
if err := this.Add(uid, ls); err != nil {
|
||||
log.Errorf("save linestory err:%v", err)
|
||||
return ls
|
||||
|
@ -6,6 +6,7 @@ package linestory
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
@ -57,7 +58,7 @@ func (this *ModuleLinestory) Start() (err error) {
|
||||
// 世界任务完成通知
|
||||
func (this *ModuleLinestory) TaskFinishNotify(uid string, taskId, groupId int32) error {
|
||||
ls := this.modelLinestory.getLinestory(uid)
|
||||
|
||||
log.Debug("支线剧情任务", log.Fields{"uid": uid, "groupId": groupId, "taskId": taskId})
|
||||
var isUpdate bool
|
||||
if chapter, ok := ls.TaskChapter[groupId]; ok {
|
||||
if _, ok := utils.Findx(chapter.TaskIds, taskId); !ok {
|
||||
@ -73,16 +74,28 @@ func (this *ModuleLinestory) TaskFinishNotify(uid string, taskId, groupId int32)
|
||||
// 重置任务ID
|
||||
if conf, ok := this.confMaintask.GetDataMap()[taskId]; ok {
|
||||
if conf.Group == groupId {
|
||||
var newTaskList []int32
|
||||
for _, v := range conf.Resetto {
|
||||
newTaskList = utils.Deletex(chapter.TaskIds, v)
|
||||
if len(conf.Resetto) > 0 {
|
||||
var newTaskList []int32
|
||||
for _, v := range conf.Resetto {
|
||||
newTaskList = utils.Deletex(chapter.TaskIds, v)
|
||||
}
|
||||
chapter.TaskIds = newTaskList
|
||||
}
|
||||
chapter.TaskIds = newTaskList
|
||||
}
|
||||
}
|
||||
isUpdate = true
|
||||
}
|
||||
} else {
|
||||
// 校验groupId 或taskId是否合法
|
||||
if _, ok := this.confTimeline.GetDataMap()[groupId]; !ok {
|
||||
this.Debug("非支线剧情任务", log.Fields{"uid": uid, "groupId": groupId, "taskId": taskId})
|
||||
return comm.NewCustomError(pb.ErrorCode_ReqParameterError)
|
||||
}
|
||||
if _, ok := this.confMaintask.GetDataMap()[taskId]; !ok {
|
||||
this.Debug("非支线剧情任务", log.Fields{"uid": uid, "groupId": groupId, "taskId": taskId})
|
||||
return comm.NewCustomError(pb.ErrorCode_ReqParameterError)
|
||||
}
|
||||
|
||||
tg := &pb.TaskChapter{}
|
||||
// 设置完成的任务
|
||||
tg.TaskIds = append(tg.TaskIds, taskId)
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
// 战斗结束的请求
|
||||
func (this *apiComp) BattlefinishCheck(session comm.IUserSession, req *pb.WorldtaskBattleFinishReq) (code pb.ErrorCode) {
|
||||
if req.BattleConfId == 0 || req.TaskId == 0 || req.Report == nil {
|
||||
this.module.Error("参数错误", log.Fields{"uid": session.GetUserId(), "params": req})
|
||||
this.module.Error("世界任务战斗结束参数错误", log.Fields{"uid": session.GetUserId(), "params": req})
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
}
|
||||
return
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
// 战斗开始
|
||||
func (this *apiComp) BattlestartCheck(session comm.IUserSession, req *pb.WorldtaskBattleStartReq) (code pb.ErrorCode) {
|
||||
if req.BattleConfId == 0 || req.Battle != nil {
|
||||
this.module.Error("参数错误", log.Fields{"uid": session.GetUserId(), "params": req})
|
||||
this.module.Error("世界任务战斗开始参数错误", log.Fields{"uid": session.GetUserId(), "params": req})
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
}
|
||||
return
|
||||
|
@ -8,11 +8,11 @@ import (
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// 任务完成
|
||||
// 世界任务完成
|
||||
|
||||
func (this *apiComp) FinishCheck(session comm.IUserSession, req *pb.WorldtaskFinishReq) (code pb.ErrorCode) {
|
||||
if req.GroupId == 0 || req.TaskId == 0 {
|
||||
this.module.Error("参数错误", log.Fields{"uid": session.GetUserId(), "params": req})
|
||||
this.module.Error("世界任务完成参数错误", log.Fields{"uid": session.GetUserId(), "params": req})
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
}
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user