移除世界任务进度推送
This commit is contained in:
parent
98ff8233cb
commit
e28eccd873
@ -34,11 +34,11 @@ func (this *ModuleRobot_WTask) Receive(robot IRobot, stype string, message proto
|
||||
case "info":
|
||||
resp := message.(*pb.WTaskInfoResp)
|
||||
this.info = resp.Info
|
||||
this.progress = resp.Accepts
|
||||
// this.progress = resp.Accepts
|
||||
break
|
||||
case "accept":
|
||||
resp := message.(*pb.WTaskAcceptResp)
|
||||
this.progress = resp.Accepts
|
||||
// this.progress = resp.Accepts
|
||||
if this.info != nil {
|
||||
this.info.Activations = resp.Activations
|
||||
this.info.Accepts = make([]int32, 0)
|
||||
@ -80,17 +80,17 @@ func (this *ModuleRobot_WTask) Receive(robot IRobot, stype string, message proto
|
||||
this.info.Activations = resp.Activations
|
||||
}
|
||||
break
|
||||
case "acceptchange":
|
||||
resp := message.(*pb.WTaskAcceptChangePush)
|
||||
// log.Debug("[机器人 WTask-AcceptChange]", log.Field{Key: "Account", Value: robot.Account()}, log.Field{Key: "Resp", Value: resp.String()})
|
||||
this.progress = resp.Accepts
|
||||
if this.info != nil {
|
||||
this.info.Accepts = make([]int32, 0)
|
||||
for _, v := range this.progress {
|
||||
this.info.Accepts = append(this.info.Accepts, v.Tid)
|
||||
}
|
||||
}
|
||||
break
|
||||
// case "acceptchange":
|
||||
// resp := message.(*pb.WTaskAcceptChangePush)
|
||||
// // log.Debug("[机器人 WTask-AcceptChange]", log.Field{Key: "Account", Value: robot.Account()}, log.Field{Key: "Resp", Value: resp.String()})
|
||||
// this.progress = resp.Accepts
|
||||
// if this.info != nil {
|
||||
// this.info.Accepts = make([]int32, 0)
|
||||
// for _, v := range this.progress {
|
||||
// this.info.Accepts = append(this.info.Accepts, v.Tid)
|
||||
// }
|
||||
// }
|
||||
// break
|
||||
case "boxchange":
|
||||
resp := message.(*pb.WTaskBoxChangePush)
|
||||
this.info.Boxs = resp.Boxs
|
||||
|
@ -16,13 +16,13 @@ func (this *apiComp) AcceptCheck(session comm.IUserSession, req *pb.WTaskAcceptR
|
||||
// /获取系统公告
|
||||
func (this *apiComp) Accept(session comm.IUserSession, req *pb.WTaskAcceptReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
wtask *pb.DBWTask
|
||||
conf *cfg.GameWorldTaskData
|
||||
progress []*pb.DBWTaskItem
|
||||
update map[string]interface{} = make(map[string]interface{})
|
||||
boxs map[int32]int32
|
||||
ok bool
|
||||
err error
|
||||
wtask *pb.DBWTask
|
||||
conf *cfg.GameWorldTaskData
|
||||
// progress []*pb.DBWTaskItem
|
||||
update map[string]interface{} = make(map[string]interface{})
|
||||
boxs map[int32]int32
|
||||
ok bool
|
||||
err error
|
||||
)
|
||||
if errdata = this.AcceptCheck(session, req); errdata != nil {
|
||||
return
|
||||
@ -96,11 +96,9 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.WTaskAcceptReq) (
|
||||
}
|
||||
}
|
||||
|
||||
if progress, errdata = this.module.pushtaskprogress(session, wtask, false); errdata != nil {
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "accept", &pb.WTaskAcceptResp{Tid: req.Tid, Activations: wtask.Activations, Accepts: progress})
|
||||
|
||||
// if progress, errdata = this.module.pushtaskprogress(session, wtask, false); errdata != nil {
|
||||
// return
|
||||
// }
|
||||
if err = this.module.modelwtask.Change(session.GetUserId(), update); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
@ -109,7 +107,7 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.WTaskAcceptReq) (
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), "accept", &pb.WTaskAcceptResp{Tid: req.Tid, Activations: wtask.Activations})
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResAddType, "WTaskAcceptReq", conf.GetItem)
|
||||
})
|
||||
|
@ -14,9 +14,9 @@ func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.WTaskInfoReq)
|
||||
// /获取系统公告
|
||||
func (this *apiComp) Info(session comm.IUserSession, req *pb.WTaskInfoReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
wtask *pb.DBWTask
|
||||
progress []*pb.DBWTaskItem
|
||||
err error
|
||||
wtask *pb.DBWTask
|
||||
// progress []*pb.DBWTaskItem
|
||||
err error
|
||||
)
|
||||
if errdata = this.InfoCheck(session, req); errdata != nil {
|
||||
return
|
||||
@ -33,10 +33,10 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.WTaskInfoReq) (errd
|
||||
if _, errdata = this.module.fishtask(session, wtask, false); errdata != nil {
|
||||
return
|
||||
}
|
||||
if progress, errdata = this.module.pushtaskprogress(session, wtask, false); errdata != nil {
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "info", &pb.WTaskInfoResp{Info: wtask, Accepts: progress})
|
||||
// if progress, errdata = this.module.pushtaskprogress(session, wtask, false); errdata != nil {
|
||||
// return
|
||||
// }
|
||||
session.SendMsg(string(this.module.GetType()), "info", &pb.WTaskInfoResp{Info: wtask})
|
||||
if err = this.module.modelwtask.updateUserWTasks(session.GetUserId(), wtask); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
|
@ -73,84 +73,84 @@ func (this *WTask) OnInstallComp() {
|
||||
|
||||
// 埋点通知
|
||||
func (this *WTask) BuriedsNotify(session comm.IUserSession, condis []*pb.ConIProgress) {
|
||||
var (
|
||||
condisMap map[int32]*pb.ConIProgress = make(map[int32]*pb.ConIProgress)
|
||||
utask *pb.DBWTask
|
||||
accepttaskMap map[int32]struct{} = make(map[int32]struct{})
|
||||
condlTask map[int32][]*cfg.GameWorldTaskData
|
||||
temptasks []*cfg.GameWorldTaskData
|
||||
changetasks map[int32]*cfg.GameWorldTaskData = make(map[int32]*cfg.GameWorldTaskData)
|
||||
checkcondlsMap map[int32]struct{} = make(map[int32]struct{})
|
||||
checkcondls []int32 = make([]int32, 0)
|
||||
detailstasks []*pb.DBWTaskItem = make([]*pb.DBWTaskItem, 0)
|
||||
ok bool
|
||||
needcheck bool //是否需要校验
|
||||
// var (
|
||||
// condisMap map[int32]*pb.ConIProgress = make(map[int32]*pb.ConIProgress)
|
||||
// utask *pb.DBWTask
|
||||
// accepttaskMap map[int32]struct{} = make(map[int32]struct{})
|
||||
// condlTask map[int32][]*cfg.GameWorldTaskData
|
||||
// temptasks []*cfg.GameWorldTaskData
|
||||
// changetasks map[int32]*cfg.GameWorldTaskData = make(map[int32]*cfg.GameWorldTaskData)
|
||||
// checkcondlsMap map[int32]struct{} = make(map[int32]struct{})
|
||||
// checkcondls []int32 = make([]int32, 0)
|
||||
// detailstasks []*pb.DBWTaskItem = make([]*pb.DBWTaskItem, 0)
|
||||
// ok bool
|
||||
// needcheck bool //是否需要校验
|
||||
|
||||
err error
|
||||
)
|
||||
this.Debug("收到子任务进度变化推送", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "condis", Value: condis})
|
||||
if utask, err = this.modelwtask.getUserWTasks(session.GetUserId()); err != nil {
|
||||
this.Error("读取玩家世界任务数据 失败", log.Field{Key: "err", Value: err.Error()})
|
||||
return
|
||||
}
|
||||
condlTask = this.configure.getcondlTask()
|
||||
// err error
|
||||
// )
|
||||
// this.Debug("收到子任务进度变化推送", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "condis", Value: condis})
|
||||
// if utask, err = this.modelwtask.getUserWTasks(session.GetUserId()); err != nil {
|
||||
// this.Error("读取玩家世界任务数据 失败", log.Field{Key: "err", Value: err.Error()})
|
||||
// return
|
||||
// }
|
||||
// condlTask = this.configure.getcondlTask()
|
||||
|
||||
for _, v := range condis {
|
||||
condisMap[v.Conid] = v
|
||||
}
|
||||
// for _, v := range condis {
|
||||
// condisMap[v.Conid] = v
|
||||
// }
|
||||
|
||||
for _, v := range utask.Accepts {
|
||||
accepttaskMap[v] = struct{}{}
|
||||
}
|
||||
// for _, v := range utask.Accepts {
|
||||
// accepttaskMap[v] = struct{}{}
|
||||
// }
|
||||
|
||||
for _, v := range condis {
|
||||
if temptasks, ok = condlTask[v.Conid]; ok {
|
||||
for _, task := range temptasks {
|
||||
if _, ok = accepttaskMap[task.Key]; ok { //任务列表进度有变化
|
||||
if _, ok = changetasks[task.Key]; !ok {
|
||||
changetasks[task.Key] = task
|
||||
for _, cid := range task.Completetask {
|
||||
if _, ok = checkcondlsMap[cid]; !ok {
|
||||
checkcondlsMap[cid] = struct{}{}
|
||||
checkcondls = append(checkcondls, cid)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(changetasks) == 0 { //没有任务变化
|
||||
return
|
||||
}
|
||||
for k, _ := range checkcondlsMap {
|
||||
if _, ok = condisMap[k]; !ok {
|
||||
needcheck = true
|
||||
}
|
||||
}
|
||||
if needcheck { //校验有变化的任务 的完成条件
|
||||
if condis, err = this.ModuleBuried.CheckCondition(session, checkcondls...); err != nil {
|
||||
this.Error("校验玩家子任务进度数据 失败", log.Field{Key: "err", Value: err.Error()})
|
||||
return
|
||||
}
|
||||
for _, v := range condis {
|
||||
condisMap[v.Conid] = v
|
||||
}
|
||||
}
|
||||
// for _, v := range condis {
|
||||
// if temptasks, ok = condlTask[v.Conid]; ok {
|
||||
// for _, task := range temptasks {
|
||||
// if _, ok = accepttaskMap[task.Key]; ok { //任务列表进度有变化
|
||||
// if _, ok = changetasks[task.Key]; !ok {
|
||||
// changetasks[task.Key] = task
|
||||
// for _, cid := range task.Completetask {
|
||||
// if _, ok = checkcondlsMap[cid]; !ok {
|
||||
// checkcondlsMap[cid] = struct{}{}
|
||||
// checkcondls = append(checkcondls, cid)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if len(changetasks) == 0 { //没有任务变化
|
||||
// return
|
||||
// }
|
||||
// for k, _ := range checkcondlsMap {
|
||||
// if _, ok = condisMap[k]; !ok {
|
||||
// needcheck = true
|
||||
// }
|
||||
// }
|
||||
// if needcheck { //校验有变化的任务 的完成条件
|
||||
// if condis, err = this.ModuleBuried.CheckCondition(session, checkcondls...); err != nil {
|
||||
// this.Error("校验玩家子任务进度数据 失败", log.Field{Key: "err", Value: err.Error()})
|
||||
// return
|
||||
// }
|
||||
// for _, v := range condis {
|
||||
// condisMap[v.Conid] = v
|
||||
// }
|
||||
// }
|
||||
|
||||
//推送进度变化消息
|
||||
for k, v := range changetasks {
|
||||
task := &pb.DBWTaskItem{
|
||||
Tid: k,
|
||||
Conlds: make([]*pb.ConIProgress, len(v.Completetask)),
|
||||
}
|
||||
for i, v := range v.Completetask {
|
||||
task.Conlds[i] = condisMap[v]
|
||||
}
|
||||
detailstasks = append(detailstasks, task)
|
||||
}
|
||||
//发送进度变化消息
|
||||
session.SendMsg(string(this.GetType()), "acceptchange", &pb.WTaskAcceptChangePush{Accepts: detailstasks})
|
||||
// //推送进度变化消息
|
||||
// for k, v := range changetasks {
|
||||
// task := &pb.DBWTaskItem{
|
||||
// Tid: k,
|
||||
// Conlds: make([]*pb.ConIProgress, len(v.Completetask)),
|
||||
// }
|
||||
// for i, v := range v.Completetask {
|
||||
// task.Conlds[i] = condisMap[v]
|
||||
// }
|
||||
// detailstasks = append(detailstasks, task)
|
||||
// }
|
||||
// //发送进度变化消息
|
||||
// session.SendMsg(string(this.GetType()), "acceptchange", &pb.WTaskAcceptChangePush{Accepts: detailstasks})
|
||||
}
|
||||
|
||||
// 功能开启
|
||||
@ -475,7 +475,7 @@ func (this *WTask) ClearCaravanTask(session comm.IUserSession, task int32) {
|
||||
}
|
||||
|
||||
if change {
|
||||
this.pushtaskprogress(session, wtask, true)
|
||||
// this.pushtaskprogress(session, wtask, true)
|
||||
if err = this.modelwtask.updateUserWTasks(session.GetUserId(), wtask); err != nil {
|
||||
this.Errorln(err)
|
||||
return
|
||||
@ -577,77 +577,77 @@ func (this *WTask) BingoJumpTask(session comm.IUserSession, taskId int32) (errda
|
||||
}
|
||||
|
||||
// 校验任务进度
|
||||
func (this *WTask) pushtaskprogress(session comm.IUserSession, wtask *pb.DBWTask, ispush bool) (progress []*pb.DBWTaskItem, errdata *pb.ErrorData) {
|
||||
var (
|
||||
checkcondlsMap map[int32]struct{} = make(map[int32]struct{})
|
||||
checkcondls []int32 = make([]int32, 0)
|
||||
conf *cfg.GameWorldTaskData
|
||||
condis []*pb.ConIProgress = make([]*pb.ConIProgress, 0)
|
||||
condisMap map[int32]*pb.ConIProgress = make(map[int32]*pb.ConIProgress)
|
||||
err error
|
||||
ok bool
|
||||
)
|
||||
progress = make([]*pb.DBWTaskItem, 0)
|
||||
if len(wtask.Accepts) == 0 {
|
||||
return
|
||||
}
|
||||
// func (this *WTask) pushtaskprogress(session comm.IUserSession, wtask *pb.DBWTask, ispush bool) (progress []*pb.DBWTaskItem, errdata *pb.ErrorData) {
|
||||
// var (
|
||||
// checkcondlsMap map[int32]struct{} = make(map[int32]struct{})
|
||||
// checkcondls []int32 = make([]int32, 0)
|
||||
// conf *cfg.GameWorldTaskData
|
||||
// condis []*pb.ConIProgress = make([]*pb.ConIProgress, 0)
|
||||
// condisMap map[int32]*pb.ConIProgress = make(map[int32]*pb.ConIProgress)
|
||||
// err error
|
||||
// ok bool
|
||||
// )
|
||||
// progress = make([]*pb.DBWTaskItem, 0)
|
||||
// if len(wtask.Accepts) == 0 {
|
||||
// return
|
||||
// }
|
||||
|
||||
for _, v := range wtask.Accepts {
|
||||
if conf, err = this.configure.gettaskconfconfigure(v); err != nil {
|
||||
this.Errorln(err)
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
for _, v := range conf.Completetask {
|
||||
if _, ok = checkcondlsMap[v]; !ok {
|
||||
checkcondlsMap[v] = struct{}{}
|
||||
checkcondls = append(checkcondls, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(checkcondls) > 0 {
|
||||
if condis, err = this.ModuleBuried.CheckCondition(session, checkcondls...); err != nil {
|
||||
this.Error("校验玩家子任务进度数据 失败", log.Field{Key: "err", Value: err.Error()})
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ExternalModule,
|
||||
Title: pb.ErrorCode_ExternalModule.ToString(),
|
||||
Message: fmt.Sprintf("ModuleBuried.CheckCondition Error:%s", err.Error()),
|
||||
}
|
||||
return
|
||||
}
|
||||
for _, v := range condis {
|
||||
condisMap[v.Conid] = v
|
||||
}
|
||||
}
|
||||
// for _, v := range wtask.Accepts {
|
||||
// if conf, err = this.configure.gettaskconfconfigure(v); err != nil {
|
||||
// this.Errorln(err)
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_ConfigNoFound,
|
||||
// Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
// Message: err.Error(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// for _, v := range conf.Completetask {
|
||||
// if _, ok = checkcondlsMap[v]; !ok {
|
||||
// checkcondlsMap[v] = struct{}{}
|
||||
// checkcondls = append(checkcondls, v)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if len(checkcondls) > 0 {
|
||||
// if condis, err = this.ModuleBuried.CheckCondition(session, checkcondls...); err != nil {
|
||||
// this.Error("校验玩家子任务进度数据 失败", log.Field{Key: "err", Value: err.Error()})
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_ExternalModule,
|
||||
// Title: pb.ErrorCode_ExternalModule.ToString(),
|
||||
// Message: fmt.Sprintf("ModuleBuried.CheckCondition Error:%s", err.Error()),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// for _, v := range condis {
|
||||
// condisMap[v.Conid] = v
|
||||
// }
|
||||
// }
|
||||
|
||||
for _, v := range wtask.Accepts {
|
||||
if conf, err = this.configure.gettaskconfconfigure(v); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
task := &pb.DBWTaskItem{
|
||||
Tid: v,
|
||||
Conlds: make([]*pb.ConIProgress, len(conf.Completetask)),
|
||||
}
|
||||
ok = true
|
||||
for i, v := range conf.Completetask {
|
||||
task.Conlds[i] = condisMap[v]
|
||||
}
|
||||
progress = append(progress, task)
|
||||
}
|
||||
if ispush {
|
||||
session.SendMsg(string(this.GetType()), "acceptchange", &pb.WTaskAcceptChangePush{Accepts: progress})
|
||||
}
|
||||
return
|
||||
}
|
||||
// for _, v := range wtask.Accepts {
|
||||
// if conf, err = this.configure.gettaskconfconfigure(v); err != nil {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_ConfigNoFound,
|
||||
// Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
// Message: err.Error(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// task := &pb.DBWTaskItem{
|
||||
// Tid: v,
|
||||
// Conlds: make([]*pb.ConIProgress, len(conf.Completetask)),
|
||||
// }
|
||||
// ok = true
|
||||
// for i, v := range conf.Completetask {
|
||||
// task.Conlds[i] = condisMap[v]
|
||||
// }
|
||||
// progress = append(progress, task)
|
||||
// }
|
||||
// if ispush {
|
||||
// session.SendMsg(string(this.GetType()), "acceptchange", &pb.WTaskAcceptChangePush{Accepts: progress})
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
|
||||
// 完成任务
|
||||
func (this *WTask) fishtask(session comm.IUserSession, wtask *pb.DBWTask, ispush bool) (progress []*pb.DBWTaskItem, errdata *pb.ErrorData) {
|
||||
@ -772,7 +772,7 @@ func (this *WTask) inquireActivations(session comm.IUserSession, wtask *pb.DBWTa
|
||||
if errdata = this.ModuleBuried.ActiveCondition(session, condiIds...); err != nil {
|
||||
return
|
||||
}
|
||||
progress, errdata = this.pushtaskprogress(session, wtask, ispush)
|
||||
// progress, errdata = this.pushtaskprogress(session, wtask, ispush)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user