上传商队任务接口调整
This commit is contained in:
parent
2aea968464
commit
051f2e36c4
@ -411,8 +411,8 @@ func (this *Worldtask) JumpTaskByTaskId(session comm.IUserSession, taskId int32)
|
|||||||
func (this *Worldtask) AcceptCaravanTask(session comm.IUserSession, groupId int32) (task *pb.Worldtask, errdata *pb.ErrorData) {
|
func (this *Worldtask) AcceptCaravanTask(session comm.IUserSession, groupId int32) (task *pb.Worldtask, errdata *pb.ErrorData) {
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
var (
|
var (
|
||||||
curTaskConf *cfg.GameWorldTaskData
|
// curTaskConf *cfg.GameWorldTaskData
|
||||||
isfinsh bool
|
// isfinsh bool
|
||||||
)
|
)
|
||||||
mytask, err := this.modelWorldtask.getWorldtask(uid)
|
mytask, err := this.modelWorldtask.getWorldtask(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -433,7 +433,7 @@ func (this *Worldtask) AcceptCaravanTask(session comm.IUserSession, groupId int3
|
|||||||
TaskType: v.Des,
|
TaskType: v.Des,
|
||||||
NpcStatus: 1,
|
NpcStatus: 1,
|
||||||
}
|
}
|
||||||
curTaskConf = v
|
// curTaskConf = v
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -449,21 +449,21 @@ func (this *Worldtask) AcceptCaravanTask(session comm.IUserSession, groupId int3
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if mytask.CurrentTasks == nil {
|
// if mytask.CurrentTasks == nil {
|
||||||
mytask.CurrentTasks = make(map[int32]*pb.Worldtasks)
|
// mytask.CurrentTasks = make(map[int32]*pb.Worldtasks)
|
||||||
}
|
// }
|
||||||
|
|
||||||
if _, ok1 := mytask.CurrentTasks[curTaskConf.Group]; !ok1 {
|
// if _, ok1 := mytask.CurrentTasks[curTaskConf.Group]; !ok1 {
|
||||||
mytask.CurrentTasks[curTaskConf.Group] = &pb.Worldtasks{
|
// mytask.CurrentTasks[curTaskConf.Group] = &pb.Worldtasks{
|
||||||
TaskMap: make(map[int32]*pb.Worldtask),
|
// TaskMap: make(map[int32]*pb.Worldtask),
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
mytask.CurrentTasks[curTaskConf.Group].TaskMap[task.TaskId] = &pb.Worldtask{
|
// mytask.CurrentTasks[curTaskConf.Group].TaskMap[task.TaskId] = &pb.Worldtask{
|
||||||
TaskId: task.TaskId,
|
// TaskId: task.TaskId,
|
||||||
TaskType: curTaskConf.Des,
|
// TaskType: curTaskConf.Des,
|
||||||
NpcStatus: 1,
|
// NpcStatus: 1,
|
||||||
}
|
// }
|
||||||
// if err = this.ModuleBuried.ActiveCondition(uid, curTaskConf.Completetask...); err != nil {
|
// if err = this.ModuleBuried.ActiveCondition(uid, curTaskConf.Completetask...); err != nil {
|
||||||
// log.Errorf("调用接口错误:%s", err.Error())
|
// log.Errorf("调用接口错误:%s", err.Error())
|
||||||
// errdata = &pb.ErrorData{
|
// errdata = &pb.ErrorData{
|
||||||
@ -473,39 +473,39 @@ func (this *Worldtask) AcceptCaravanTask(session comm.IUserSession, groupId int3
|
|||||||
// }
|
// }
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
if task.Conds, err = this.ModuleBuried.CheckCondition(uid, curTaskConf.Completetask...); err != nil {
|
// if task.Conds, err = this.ModuleBuried.CheckCondition(uid, curTaskConf.Completetask...); err != nil {
|
||||||
log.Errorf("调用接口错误:%s", err.Error())
|
// log.Errorf("调用接口错误:%s", err.Error())
|
||||||
errdata = &pb.ErrorData{
|
// errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ExternalModule,
|
// Code: pb.ErrorCode_ExternalModule,
|
||||||
Title: pb.ErrorCode_ExternalModule.String(),
|
// Title: pb.ErrorCode_ExternalModule.String(),
|
||||||
Message: fmt.Sprintf("ModuleBuried.CheckCondition err:%s", err.Error()),
|
// Message: fmt.Sprintf("ModuleBuried.CheckCondition err:%s", err.Error()),
|
||||||
}
|
// }
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
isfinsh = true
|
// isfinsh = true
|
||||||
for _, v := range task.Conds {
|
// for _, v := range task.Conds {
|
||||||
if v.State != pb.BuriedItemFinishState_buried_finish {
|
// if v.State != pb.BuriedItemFinishState_buried_finish {
|
||||||
isfinsh = false
|
// isfinsh = false
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if isfinsh && curTaskConf.DeliverNpc != 0 {
|
// if isfinsh && curTaskConf.DeliverNpc != 0 {
|
||||||
isfinsh = false
|
// isfinsh = false
|
||||||
}
|
// }
|
||||||
//判断是否要结束任务
|
// //判断是否要结束任务
|
||||||
if ((len(curTaskConf.Completetask) >= 1 && curTaskConf.Completetask[0] == 0) ||
|
// if ((len(curTaskConf.Completetask) >= 1 && curTaskConf.Completetask[0] == 0) ||
|
||||||
len(curTaskConf.Completetask) == 0) && curTaskConf.DeliverNpc == 0 {
|
// len(curTaskConf.Completetask) == 0) && curTaskConf.DeliverNpc == 0 {
|
||||||
isfinsh = true
|
// isfinsh = true
|
||||||
}
|
// }
|
||||||
|
|
||||||
update := map[string]interface{}{
|
// update := map[string]interface{}{
|
||||||
"currentTasks": mytask.CurrentTasks,
|
// "currentTasks": mytask.CurrentTasks,
|
||||||
}
|
// }
|
||||||
if err := this.modelWorldtask.Change(uid, update); err != nil {
|
// if err := this.modelWorldtask.Change(uid, update); err != nil {
|
||||||
}
|
// }
|
||||||
if isfinsh { //结束任务
|
// if isfinsh { //结束任务
|
||||||
this.modelWorldtask.taskFinish(session, task.TaskId, mytask, curTaskConf)
|
// this.modelWorldtask.taskFinish(session, task.TaskId, mytask, curTaskConf)
|
||||||
this.modelWorldtask.taskFinishPush(session, mytask, curTaskConf)
|
// this.modelWorldtask.taskFinishPush(session, mytask, curTaskConf)
|
||||||
}
|
// }
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user