Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
72cc4fb9e0
@ -1201,7 +1201,7 @@
|
|||||||
"tasktxt": "",
|
"tasktxt": "",
|
||||||
"type": 70,
|
"type": 70,
|
||||||
"valid": 0,
|
"valid": 0,
|
||||||
"NPC": 4,
|
"NPC": 10110,
|
||||||
"data1": 1,
|
"data1": 1,
|
||||||
"data2": 114,
|
"data2": 114,
|
||||||
"data3": 4,
|
"data3": 4,
|
||||||
|
@ -322,7 +322,7 @@
|
|||||||
"key": 20100,
|
"key": 20100,
|
||||||
"lock": 1,
|
"lock": 1,
|
||||||
"ontxe": 20090,
|
"ontxe": 20090,
|
||||||
"id_after": 0,
|
"id_after": 20110,
|
||||||
"group": 20010,
|
"group": 20010,
|
||||||
"des": 2,
|
"des": 2,
|
||||||
"icon": "",
|
"icon": "",
|
||||||
@ -343,7 +343,7 @@
|
|||||||
307
|
307
|
||||||
],
|
],
|
||||||
"deliver_npc": 10102,
|
"deliver_npc": 10102,
|
||||||
"auto_accept": 1,
|
"auto_accept": 0,
|
||||||
"reword": [
|
"reword": [
|
||||||
{
|
{
|
||||||
"a": "item",
|
"a": "item",
|
||||||
@ -353,6 +353,41 @@
|
|||||||
],
|
],
|
||||||
"module": []
|
"module": []
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"key": 20110,
|
||||||
|
"lock": 0,
|
||||||
|
"ontxe": 20100,
|
||||||
|
"id_after": 0,
|
||||||
|
"group": 20010,
|
||||||
|
"des": 2,
|
||||||
|
"icon": "",
|
||||||
|
"task_Tname": {
|
||||||
|
"key": "Mainline_Tasks",
|
||||||
|
"text": "1"
|
||||||
|
},
|
||||||
|
"task_name": {
|
||||||
|
"key": "Mainline_Tasks_11",
|
||||||
|
"text": "敬请期待"
|
||||||
|
},
|
||||||
|
"task_display": {
|
||||||
|
"key": "story_80",
|
||||||
|
"text": "1"
|
||||||
|
},
|
||||||
|
"npc": 10110,
|
||||||
|
"completetask": [
|
||||||
|
193
|
||||||
|
],
|
||||||
|
"deliver_npc": 0,
|
||||||
|
"auto_accept": 0,
|
||||||
|
"reword": [
|
||||||
|
{
|
||||||
|
"a": "item",
|
||||||
|
"t": "110001",
|
||||||
|
"n": 110
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"module": []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"key": 30010,
|
"key": 30010,
|
||||||
"lock": 1,
|
"lock": 1,
|
||||||
|
@ -38,12 +38,11 @@ func (a *apiComp) Accept(session comm.IUserSession, req *pb.WorldtaskAcceptReq)
|
|||||||
myWorldtask.CurrentTask = make(map[int32]*pb.Worldtask)
|
myWorldtask.CurrentTask = make(map[int32]*pb.Worldtask)
|
||||||
}
|
}
|
||||||
myWorldtask.CurrentTask[curTaskConf.Group] = &pb.Worldtask{
|
myWorldtask.CurrentTask[curTaskConf.Group] = &pb.Worldtask{
|
||||||
TaskId: req.TaskId,
|
TaskId: req.TaskId,
|
||||||
TaskType: curTaskConf.Des,
|
TaskType: curTaskConf.Des,
|
||||||
|
NpcStatus: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
myWorldtask.CurrentTask[curTaskConf.Group].NpcStatus = 1
|
|
||||||
|
|
||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
"currentTask": myWorldtask.CurrentTask,
|
"currentTask": myWorldtask.CurrentTask,
|
||||||
}
|
}
|
||||||
|
@ -179,10 +179,12 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
|||||||
// 章节完成
|
// 章节完成
|
||||||
if _, ok := userTask.Chapters[req.GroupId]; !ok {
|
if _, ok := userTask.Chapters[req.GroupId]; !ok {
|
||||||
if userTask.Chapters == nil {
|
if userTask.Chapters == nil {
|
||||||
|
delete(userTask.CurrentTask, req.GroupId)
|
||||||
userTask.Chapters = make(map[int32]int32)
|
userTask.Chapters = make(map[int32]int32)
|
||||||
userTask.Chapters[req.GroupId] = 1 //已解锁待领取
|
userTask.Chapters[req.GroupId] = 1 //已解锁待领取
|
||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
"chapters": userTask.Chapters,
|
"chapters": userTask.Chapters,
|
||||||
|
"currentTask": userTask.CurrentTask,
|
||||||
}
|
}
|
||||||
this.module.modelWorldtask.Change(uid, update)
|
this.module.modelWorldtask.Change(uid, update)
|
||||||
}
|
}
|
||||||
|
@ -88,49 +88,33 @@ func (this *ModelWorldtask) finishTask(groupId, taskId int32, task *pb.DBWorldta
|
|||||||
TaskType: taskConf.Des,
|
TaskType: taskConf.Des,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, tId := range task.TaskList {
|
||||||
|
if tId == taskId {
|
||||||
|
return comm.NewCustomError(pb.ErrorCode_WorldtaskFinihed)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
task.TaskList = append(task.TaskList, taskId)
|
task.TaskList = append(task.TaskList, taskId)
|
||||||
|
|
||||||
if task.CurrentTask == nil {
|
if task.CurrentTask == nil {
|
||||||
task.CurrentTask = make(map[int32]*pb.Worldtask)
|
task.CurrentTask = make(map[int32]*pb.Worldtask)
|
||||||
}
|
}
|
||||||
|
|
||||||
wt.NpcStatus = 0
|
//判断是否有下个任务
|
||||||
wt.DeliverNpc = 0
|
if taskConf.IdAfter != 0 {
|
||||||
wt.CondiIds = []int32{}
|
wt.NpcStatus = 0
|
||||||
task.CurrentTask[groupId] = wt
|
wt.DeliverNpc = 0
|
||||||
|
wt.CondiIds = []int32{}
|
||||||
|
task.CurrentTask[groupId] = wt
|
||||||
|
update["currentTask"] = task.CurrentTask
|
||||||
|
}
|
||||||
|
|
||||||
update["taskList"] = task.TaskList
|
update["taskList"] = task.TaskList
|
||||||
update["currentTask"] = task.CurrentTask
|
|
||||||
|
|
||||||
if err := this.Change(task.Uid, update); err != nil {
|
if err := this.Change(task.Uid, update); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// if module, err := this.service.GetModule(comm.ModuleLinestory); err == nil {
|
|
||||||
// if iLinestory, ok := module.(comm.ILinestory); ok {
|
|
||||||
// if err := iLinestory.TaskFinishNotify(task.Uid, taskId, groupId); err != nil {
|
|
||||||
// log.Debug("世界任务完成通知支线剧情任务",
|
|
||||||
// log.Field{Key: "uid", Value: task.Uid},
|
|
||||||
// log.Field{Key: "groupId", Value: groupId},
|
|
||||||
// log.Field{Key: "taskId", Value: taskId},
|
|
||||||
// log.Field{Key: "err", Value: err.Error()},
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if module, err := this.service.GetModule(comm.ModuleLibrary); err == nil {
|
|
||||||
// if iLibrary, ok := module.(comm.ILibrary); ok {
|
|
||||||
// if err := iLibrary.TaskFinishNotify(task.Uid, taskId, groupId); err != nil {
|
|
||||||
// log.Debug("世界任务完成通知羁绊剧情任务",
|
|
||||||
// log.Field{Key: "uid", Value: task.Uid},
|
|
||||||
// log.Field{Key: "fetterId", Value: groupId},
|
|
||||||
// log.Field{Key: "taskId", Value: taskId},
|
|
||||||
// log.Field{Key: "err", Value: err.Error()},
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,24 +226,26 @@ func (this *ModelWorldtask) taskFinishPush(session comm.IUserSession, groupId in
|
|||||||
nextTask[groupId] = &pb.Worldtask{} //表示没有下一个任务
|
nextTask[groupId] = &pb.Worldtask{} //表示没有下一个任务
|
||||||
}
|
}
|
||||||
|
|
||||||
// 任务完成推送
|
|
||||||
session.SendMsg(string(this.moduleWorldtask.GetType()), WorldtaskNexttaskPush, &pb.WorldtaskNexttaskPush{
|
|
||||||
NextTask: nextTask,
|
|
||||||
})
|
|
||||||
|
|
||||||
if curTaskConf.IdAfter == 0 {
|
if curTaskConf.IdAfter == 0 {
|
||||||
// 章节完成
|
// 章节完成
|
||||||
if _, ok := userTask.Chapters[groupId]; !ok {
|
if _, ok := userTask.Chapters[groupId]; !ok {
|
||||||
if userTask.Chapters == nil {
|
if userTask.Chapters == nil {
|
||||||
|
delete(userTask.CurrentTask,groupId)
|
||||||
userTask.Chapters = make(map[int32]int32)
|
userTask.Chapters = make(map[int32]int32)
|
||||||
userTask.Chapters[groupId] = 1 //已解锁待领取
|
userTask.Chapters[groupId] = 1 //已解锁待领取
|
||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
"chapters": userTask.Chapters,
|
"chapters": userTask.Chapters,
|
||||||
|
"currentTask": userTask.CurrentTask,
|
||||||
}
|
}
|
||||||
this.Change(session.GetUserId(), update)
|
this.Change(session.GetUserId(), update)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 任务完成推送
|
||||||
|
session.SendMsg(string(this.moduleWorldtask.GetType()), WorldtaskNexttaskPush, &pb.WorldtaskNexttaskPush{
|
||||||
|
NextTask: nextTask,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModelWorldtask) taskFinish(session comm.IUserSession, groupId, taskId int32, userTask *pb.DBWorldtask, curTaskConf *cfg.GameWorldTaskData) {
|
func (this *ModelWorldtask) taskFinish(session comm.IUserSession, groupId, taskId int32, userTask *pb.DBWorldtask, curTaskConf *cfg.GameWorldTaskData) {
|
||||||
|
@ -70,9 +70,14 @@ func (this *Worldtask) TaskCondFinishNotify(session comm.IUserSession, condId in
|
|||||||
for _, c := range this.worldtaskConf.GetDataList() {
|
for _, c := range this.worldtaskConf.GetDataList() {
|
||||||
for _, v := range c.Completetask {
|
for _, v := range c.Completetask {
|
||||||
if v == condId {
|
if v == condId {
|
||||||
finishedTaskIds[c.Group] = c.Key
|
//校验任务是否是当前任务
|
||||||
groupId = c.Group
|
if task, ok := userTask.CurrentTask[c.Group]; ok {
|
||||||
taskId = c.Key
|
if task.NpcStatus == 1 && c.Key == task.TaskId{
|
||||||
|
finishedTaskIds[c.Group] = c.Key
|
||||||
|
groupId = c.Group
|
||||||
|
taskId = c.Key
|
||||||
|
}
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,6 +102,7 @@ func (this *Worldtask) TaskCondFinishNotify(session comm.IUserSession, condId in
|
|||||||
|
|
||||||
userTask.CurrentTask[groupId] = wt
|
userTask.CurrentTask[groupId] = wt
|
||||||
|
|
||||||
|
this.Debug("当前任务更新", log.Field{Key: "currentTask", Value: userTask.CurrentTask})
|
||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
"currentTask": userTask.CurrentTask,
|
"currentTask": userTask.CurrentTask,
|
||||||
}
|
}
|
||||||
@ -111,14 +117,14 @@ func (this *Worldtask) TaskCondFinishNotify(session comm.IUserSession, condId in
|
|||||||
log.Field{Key: "condiIds", Value: wt.CondiIds},
|
log.Field{Key: "condiIds", Value: wt.CondiIds},
|
||||||
log.Field{Key: "taskId", Value: taskId})
|
log.Field{Key: "taskId", Value: taskId})
|
||||||
|
|
||||||
//判断是否要结束任务
|
|
||||||
// 当前任务配置
|
// 当前任务配置
|
||||||
curTaskConf, err := this.configure.getWorldtaskById(taskId)
|
curTaskConf, err := this.configure.getWorldtaskById(taskId)
|
||||||
if err != nil || curTaskConf == nil {
|
if err != nil || curTaskConf == nil {
|
||||||
return comm.NewCustomError(pb.ErrorCode_ConfigNoFound)
|
return comm.NewCustomError(pb.ErrorCode_ConfigNoFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//结束任务
|
||||||
if curTaskConf.DeliverNpc == 0 {
|
if curTaskConf.DeliverNpc == 0 {
|
||||||
//结束任务
|
|
||||||
this.modelWorldtask.taskFinish(session, groupId, taskId, userTask, curTaskConf)
|
this.modelWorldtask.taskFinish(session, groupId, taskId, userTask, curTaskConf)
|
||||||
this.modelWorldtask.taskFinishPush(session, groupId, userTask, curTaskConf)
|
this.modelWorldtask.taskFinishPush(session, groupId, userTask, curTaskConf)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user