新版日周常

This commit is contained in:
wh_zcy 2023-04-03 19:20:19 +08:00
parent 6550da4cc0
commit d1dcc03e3a
6 changed files with 53 additions and 37 deletions

View File

@ -729,7 +729,7 @@
"lockend": 5, "lockend": 5,
"ontxe": 20010, "ontxe": 20010,
"id_after": 0, "id_after": 0,
"group": 110, "group": 111,
"des": 1, "des": 1,
"icon": "", "icon": "",
"task_Tname": { "task_Tname": {
@ -765,7 +765,7 @@
"lockend": 5, "lockend": 5,
"ontxe": 20010, "ontxe": 20010,
"id_after": 0, "id_after": 0,
"group": 110, "group": 112,
"des": 1, "des": 1,
"icon": "", "icon": "",
"task_Tname": { "task_Tname": {
@ -801,7 +801,7 @@
"lockend": 20, "lockend": 20,
"ontxe": 20010, "ontxe": 20010,
"id_after": 0, "id_after": 0,
"group": 110, "group": 113,
"des": 1, "des": 1,
"icon": "", "icon": "",
"task_Tname": { "task_Tname": {
@ -837,7 +837,7 @@
"lockend": 20, "lockend": 20,
"ontxe": 20010, "ontxe": 20010,
"id_after": 0, "id_after": 0,
"group": 110, "group": 114,
"des": 1, "des": 1,
"icon": "", "icon": "",
"task_Tname": { "task_Tname": {
@ -873,7 +873,7 @@
"lockend": 20, "lockend": 20,
"ontxe": 20010, "ontxe": 20010,
"id_after": 0, "id_after": 0,
"group": 110, "group": 115,
"des": 1, "des": 1,
"icon": "", "icon": "",
"task_Tname": { "task_Tname": {
@ -909,7 +909,7 @@
"lockend": 20, "lockend": 20,
"ontxe": 20010, "ontxe": 20010,
"id_after": 0, "id_after": 0,
"group": 110, "group": 116,
"des": 1, "des": 1,
"icon": "", "icon": "",
"task_Tname": { "task_Tname": {
@ -981,7 +981,7 @@
"lockend": 5, "lockend": 5,
"ontxe": 20010, "ontxe": 20010,
"id_after": 0, "id_after": 0,
"group": 410, "group": 411,
"des": 4, "des": 4,
"icon": "", "icon": "",
"task_Tname": { "task_Tname": {
@ -1017,7 +1017,7 @@
"lockend": 5, "lockend": 5,
"ontxe": 20010, "ontxe": 20010,
"id_after": 0, "id_after": 0,
"group": 410, "group": 412,
"des": 4, "des": 4,
"icon": "", "icon": "",
"task_Tname": { "task_Tname": {
@ -1053,7 +1053,7 @@
"lockend": 20, "lockend": 20,
"ontxe": 20010, "ontxe": 20010,
"id_after": 0, "id_after": 0,
"group": 410, "group": 413,
"des": 4, "des": 4,
"icon": "", "icon": "",
"task_Tname": { "task_Tname": {
@ -1089,7 +1089,7 @@
"lockend": 20, "lockend": 20,
"ontxe": 20010, "ontxe": 20010,
"id_after": 0, "id_after": 0,
"group": 410, "group": 414,
"des": 4, "des": 4,
"icon": "", "icon": "",
"task_Tname": { "task_Tname": {
@ -1125,7 +1125,7 @@
"lockend": 20, "lockend": 20,
"ontxe": 20010, "ontxe": 20010,
"id_after": 0, "id_after": 0,
"group": 410, "group": 415,
"des": 4, "des": 4,
"icon": "", "icon": "",
"task_Tname": { "task_Tname": {
@ -1161,7 +1161,7 @@
"lockend": 20, "lockend": 20,
"ontxe": 20010, "ontxe": 20010,
"id_after": 0, "id_after": 0,
"group": 410, "group": 416,
"des": 4, "des": 4,
"icon": "", "icon": "",
"task_Tname": { "task_Tname": {

View File

@ -321,7 +321,8 @@ func (this *Agent) messageDistribution(msg *pb.UserMessage) (err error) {
} }
stime := time.Now() stime := time.Now()
// this.gateway.Debugf("----------3 agent:%s uId:%s MainType:%s SubType:%s ", this.sessionId, this.uId, msg.MainType, msg.SubType) // 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 { if len(serviceTag) == 0 {
// this.gateway.Debugf("----------4 agent:%s uId:%s MainType:%s SubType:%s ", this.sessionId, this.uId, msg.MainType, msg.SubType) // 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 { if err = this.gateway.Service().RpcCall(ctx, servicePath, string(comm.Rpc_GatewayRoute), req, reply); err != nil {

View File

@ -58,8 +58,9 @@ func (a *apiComp) Accept(session comm.IUserSession, req *pb.WorldtaskAcceptReq)
session.SendMsg(string(a.module.GetType()), "accept", rsp) session.SendMsg(string(a.module.GetType()), "accept", rsp)
//判断是否要结束任务 //判断是否要结束任务
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 {
//结束任务 //结束任务
a.module.modelWorldtask.taskFinish(session, req.GroupId, req.TaskId, myWorldtask, curTaskConf) a.module.modelWorldtask.taskFinish(session, req.GroupId, req.TaskId, myWorldtask, curTaskConf)
a.module.modelWorldtask.taskFinishPush(session, req.GroupId, myWorldtask, curTaskConf) a.module.modelWorldtask.taskFinishPush(session, req.GroupId, myWorldtask, curTaskConf)

View File

@ -30,8 +30,8 @@ func (this *apiComp) CompleteCondi(session comm.IUserSession, req *pb.WorldtaskC
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
return return
} }
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 {
code = pb.ErrorCode_WorldtaskNoProcess code = pb.ErrorCode_WorldtaskNoProcess
return return
} }

View File

@ -4,10 +4,16 @@ import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/sys/log" "go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
"google.golang.org/protobuf/proto" "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) { func (this *apiComp) MineCheck(session comm.IUserSession, req *pb.WorldtaskMineReq) (code pb.ErrorCode) {
return return
@ -33,31 +39,39 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.WorldtaskMineReq) (
myWorldtask.CurrentTask = make(map[int32]*pb.Worldtask) myWorldtask.CurrentTask = make(map[int32]*pb.Worldtask)
} }
now := configure.Now().Unix()
update := make(map[string]interface{}) update := make(map[string]interface{})
// 日常 // 日常
dailyIds := this.module.randomTask(user.Lv, 1, myWorldtask) if now-myWorldtask.DaliyRefreshTime >= 3600*24 {
for _, v := range dailyIds { dailyIds := this.module.randomTask(user.Lv, dailyDes, myWorldtask)
gwtd, err := this.module.configure.getWorldtaskById(v) for _, v := range dailyIds {
if err != nil || gwtd == nil { gwtd, err := this.module.configure.getWorldtaskById(v)
continue if err != nil || gwtd == nil {
} continue
myWorldtask.CurrentTask[gwtd.Group] = &pb.Worldtask{ }
TaskId: v, myWorldtask.CurrentTask[gwtd.Group] = &pb.Worldtask{
TaskType: gwtd.Des, TaskId: v,
TaskType: gwtd.Des,
}
} }
update["daliyRefreshTime"] = configure.Now().Unix()
} }
//周常 //周常
weekIds := this.module.randomTask(user.Lv, 2, myWorldtask) if now-myWorldtask.WeekRefreshTime >= 3600*24*7 {
for _, v := range weekIds { weekIds := this.module.randomTask(user.Lv, weekDes, myWorldtask)
gwtd, err := this.module.configure.getWorldtaskById(v) for _, v := range weekIds {
if err != nil || gwtd == nil { gwtd, err := this.module.configure.getWorldtaskById(v)
continue if err != nil || gwtd == nil {
} continue
myWorldtask.CurrentTask[gwtd.Group] = &pb.Worldtask{ }
TaskId: v, myWorldtask.CurrentTask[gwtd.Group] = &pb.Worldtask{
TaskType: gwtd.Des, TaskId: v,
TaskType: gwtd.Des,
}
} }
update["weekRefreshTime"] = configure.Now().Unix()
} }
update["currentTask"] = myWorldtask.CurrentTask update["currentTask"] = myWorldtask.CurrentTask

View File

@ -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) { func (this *Worldtask) filterTask(userLv, des int32, wt *pb.DBWorldtask) (taskIds []int32) {
if des != 1 || des != 4 { if des != 1 && des != 4 {
return return
} }
gwt, err := this.configure.getWorldtaskCfg() 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.Des == des && userLv >= v.Lock && userLv <= v.Lockend {
if v.Ontxe != 0 { if v.Ontxe != 0 {
//前置 //寻找前置
if _, ok := utils.Findx(wt.TaskList, v.Ontxe); ok { if _, ok := utils.Findx(wt.TaskList, v.Ontxe); ok {
taskIds = append(taskIds, v.Key) taskIds = append(taskIds, v.Key)
} }