diff --git a/bin/json/game_worldtask.json b/bin/json/game_worldtask.json index c6619acf1..b9d9d847e 100644 --- a/bin/json/game_worldtask.json +++ b/bin/json/game_worldtask.json @@ -729,7 +729,7 @@ "lockend": 5, "ontxe": 20010, "id_after": 0, - "group": 110, + "group": 111, "des": 1, "icon": "", "task_Tname": { @@ -765,7 +765,7 @@ "lockend": 5, "ontxe": 20010, "id_after": 0, - "group": 110, + "group": 112, "des": 1, "icon": "", "task_Tname": { @@ -801,7 +801,7 @@ "lockend": 20, "ontxe": 20010, "id_after": 0, - "group": 110, + "group": 113, "des": 1, "icon": "", "task_Tname": { @@ -837,7 +837,7 @@ "lockend": 20, "ontxe": 20010, "id_after": 0, - "group": 110, + "group": 114, "des": 1, "icon": "", "task_Tname": { @@ -873,7 +873,7 @@ "lockend": 20, "ontxe": 20010, "id_after": 0, - "group": 110, + "group": 115, "des": 1, "icon": "", "task_Tname": { @@ -909,7 +909,7 @@ "lockend": 20, "ontxe": 20010, "id_after": 0, - "group": 110, + "group": 116, "des": 1, "icon": "", "task_Tname": { @@ -981,7 +981,7 @@ "lockend": 5, "ontxe": 20010, "id_after": 0, - "group": 410, + "group": 411, "des": 4, "icon": "", "task_Tname": { @@ -1017,7 +1017,7 @@ "lockend": 5, "ontxe": 20010, "id_after": 0, - "group": 410, + "group": 412, "des": 4, "icon": "", "task_Tname": { @@ -1053,7 +1053,7 @@ "lockend": 20, "ontxe": 20010, "id_after": 0, - "group": 410, + "group": 413, "des": 4, "icon": "", "task_Tname": { @@ -1089,7 +1089,7 @@ "lockend": 20, "ontxe": 20010, "id_after": 0, - "group": 410, + "group": 414, "des": 4, "icon": "", "task_Tname": { @@ -1125,7 +1125,7 @@ "lockend": 20, "ontxe": 20010, "id_after": 0, - "group": 410, + "group": 415, "des": 4, "icon": "", "task_Tname": { @@ -1161,7 +1161,7 @@ "lockend": 20, "ontxe": 20010, "id_after": 0, - "group": 410, + "group": 416, "des": 4, "icon": "", "task_Tname": { diff --git a/modules/gateway/agent.go b/modules/gateway/agent.go index b14188b33..74b540bbf 100644 --- a/modules/gateway/agent.go +++ b/modules/gateway/agent.go @@ -321,7 +321,8 @@ func (this *Agent) messageDistribution(msg *pb.UserMessage) (err error) { } stime := time.Now() // this.gateway.Debugf("----------3 agent:%s uId:%s MainType:%s SubType:%s ", this.sessionId, this.uId, msg.MainType, msg.SubType) - ctx, _ := context.WithTimeout(context.Background(), time.Second*5) + // ctx, _ := context.WithTimeout(context.Background(), time.Second*5) + ctx := context.Background() if len(serviceTag) == 0 { // this.gateway.Debugf("----------4 agent:%s uId:%s MainType:%s SubType:%s ", this.sessionId, this.uId, msg.MainType, msg.SubType) if err = this.gateway.Service().RpcCall(ctx, servicePath, string(comm.Rpc_GatewayRoute), req, reply); err != nil { diff --git a/modules/worldtask/api_accept.go b/modules/worldtask/api_accept.go index f0f68e47c..9deafab93 100644 --- a/modules/worldtask/api_accept.go +++ b/modules/worldtask/api_accept.go @@ -58,8 +58,9 @@ func (a *apiComp) Accept(session comm.IUserSession, req *pb.WorldtaskAcceptReq) session.SendMsg(string(a.module.GetType()), "accept", rsp) //判断是否要结束任务 - if (len(curTaskConf.Completetask) == 1 && curTaskConf.Completetask[0] == 0 || - len(curTaskConf.Completetask) == 0) && curTaskConf.DeliverNpc == 0 { + if ((len(curTaskConf.Completetask) == 1 && curTaskConf.Completetask[0] == 0) || + len(curTaskConf.Completetask) == 0) && + curTaskConf.DeliverNpc == 0 { //结束任务 a.module.modelWorldtask.taskFinish(session, req.GroupId, req.TaskId, myWorldtask, curTaskConf) a.module.modelWorldtask.taskFinishPush(session, req.GroupId, myWorldtask, curTaskConf) diff --git a/modules/worldtask/api_completetask.go b/modules/worldtask/api_completetask.go index b448a2c55..8f5391346 100644 --- a/modules/worldtask/api_completetask.go +++ b/modules/worldtask/api_completetask.go @@ -30,8 +30,8 @@ func (this *apiComp) CompleteCondi(session comm.IUserSession, req *pb.WorldtaskC code = pb.ErrorCode_ConfigNoFound return } - if (len(curTaskConf.Completetask) == 1 && curTaskConf.Completetask[0] == 0 || - len(curTaskConf.Completetask) == 0) && curTaskConf.DeliverNpc == 0 { + if (len(curTaskConf.Completetask) == 1 && curTaskConf.Completetask[0] == 0) || + len(curTaskConf.Completetask) == 0 { code = pb.ErrorCode_WorldtaskNoProcess return } diff --git a/modules/worldtask/api_mine.go b/modules/worldtask/api_mine.go index 4d118bf2a..487060f3d 100644 --- a/modules/worldtask/api_mine.go +++ b/modules/worldtask/api_mine.go @@ -4,10 +4,16 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" + "go_dreamfactory/sys/configure" "google.golang.org/protobuf/proto" ) +var ( + dailyDes int32 = 1 + weekDes int32 = 4 +) + // 我的世界任务 func (this *apiComp) MineCheck(session comm.IUserSession, req *pb.WorldtaskMineReq) (code pb.ErrorCode) { return @@ -33,31 +39,39 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.WorldtaskMineReq) ( myWorldtask.CurrentTask = make(map[int32]*pb.Worldtask) } + now := configure.Now().Unix() update := make(map[string]interface{}) + // 日常 - dailyIds := this.module.randomTask(user.Lv, 1, myWorldtask) - for _, v := range dailyIds { - gwtd, err := this.module.configure.getWorldtaskById(v) - if err != nil || gwtd == nil { - continue - } - myWorldtask.CurrentTask[gwtd.Group] = &pb.Worldtask{ - TaskId: v, - TaskType: gwtd.Des, + if now-myWorldtask.DaliyRefreshTime >= 3600*24 { + dailyIds := this.module.randomTask(user.Lv, dailyDes, myWorldtask) + for _, v := range dailyIds { + gwtd, err := this.module.configure.getWorldtaskById(v) + if err != nil || gwtd == nil { + continue + } + myWorldtask.CurrentTask[gwtd.Group] = &pb.Worldtask{ + TaskId: v, + TaskType: gwtd.Des, + } } + update["daliyRefreshTime"] = configure.Now().Unix() } //周常 - weekIds := this.module.randomTask(user.Lv, 2, myWorldtask) - for _, v := range weekIds { - gwtd, err := this.module.configure.getWorldtaskById(v) - if err != nil || gwtd == nil { - continue - } - myWorldtask.CurrentTask[gwtd.Group] = &pb.Worldtask{ - TaskId: v, - TaskType: gwtd.Des, + if now-myWorldtask.WeekRefreshTime >= 3600*24*7 { + weekIds := this.module.randomTask(user.Lv, weekDes, myWorldtask) + for _, v := range weekIds { + gwtd, err := this.module.configure.getWorldtaskById(v) + if err != nil || gwtd == nil { + continue + } + myWorldtask.CurrentTask[gwtd.Group] = &pb.Worldtask{ + TaskId: v, + TaskType: gwtd.Des, + } } + update["weekRefreshTime"] = configure.Now().Unix() } update["currentTask"] = myWorldtask.CurrentTask diff --git a/modules/worldtask/model_worldtask.go b/modules/worldtask/model_worldtask.go index 6ca53446c..6069a72ef 100644 --- a/modules/worldtask/model_worldtask.go +++ b/modules/worldtask/model_worldtask.go @@ -279,7 +279,7 @@ func (this *ModelWorldtask) taskFinish(session comm.IUserSession, groupId, taskI } func (this *Worldtask) filterTask(userLv, des int32, wt *pb.DBWorldtask) (taskIds []int32) { - if des != 1 || des != 4 { + if des != 1 && des != 4 { return } gwt, err := this.configure.getWorldtaskCfg() @@ -291,7 +291,7 @@ func (this *Worldtask) filterTask(userLv, des int32, wt *pb.DBWorldtask) (taskId // 主角等级 if v.Des == des && userLv >= v.Lock && userLv <= v.Lockend { if v.Ontxe != 0 { - //前置 + //寻找前置 if _, ok := utils.Findx(wt.TaskList, v.Ontxe); ok { taskIds = append(taskIds, v.Key) }