Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
6b48acda2a
@ -14,6 +14,10 @@ type (
|
|||||||
ITaskComplete interface {
|
ITaskComplete interface {
|
||||||
TaskComplete(session IUserSession, taskid int32)
|
TaskComplete(session IUserSession, taskid int32)
|
||||||
}
|
}
|
||||||
|
//功能开启通知
|
||||||
|
IOpenCmdNotice interface {
|
||||||
|
OpenCmdNotice(session IUserSession, key string)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -439,6 +443,7 @@ type (
|
|||||||
//练功房
|
//练功房
|
||||||
IPractice interface {
|
IPractice interface {
|
||||||
ITaskComplete
|
ITaskComplete
|
||||||
|
IOpenCmdNotice
|
||||||
//添加武馆资源
|
//添加武馆资源
|
||||||
AddItems(session IUserSession, items map[string]int32, bPush bool) (code pb.ErrorCode)
|
AddItems(session IUserSession, items map[string]int32, bPush bool) (code pb.ErrorCode)
|
||||||
//pvp切磋结果通知
|
//pvp切磋结果通知
|
||||||
|
@ -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 {
|
||||||
|
@ -55,6 +55,7 @@ func (this *Practice) Init(service core.IService, module core.IModule, options c
|
|||||||
this.service = service.(base.IRPCXService)
|
this.service = service.(base.IRPCXService)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Practice) Start() (err error) {
|
func (this *Practice) Start() (err error) {
|
||||||
err = this.ModuleBase.Start()
|
err = this.ModuleBase.Start()
|
||||||
var module core.IModule
|
var module core.IModule
|
||||||
@ -189,6 +190,10 @@ func (this *Practice) TaskComplete(session comm.IUserSession, taskid int32) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Practice) OpenCmdNotice(session comm.IUserSession, key string) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (this *Practice) ChallengeResults(bid, red, bule string, winSide int32) {
|
func (this *Practice) ChallengeResults(bid, red, bule string, winSide int32) {
|
||||||
this.Debug("ChallengeResults",
|
this.Debug("ChallengeResults",
|
||||||
log.Field{Key: "bid", Value: bid},
|
log.Field{Key: "bid", Value: bid},
|
||||||
|
@ -20,6 +20,12 @@ func (a *apiComp) Accept(session comm.IUserSession, req *pb.WorldtaskAcceptReq)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
|
user := a.module.ModuleUser.GetUser(uid)
|
||||||
|
if user == nil {
|
||||||
|
code = pb.ErrorCode_UserSessionNobeing
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
myWorldtask, err := a.module.modelWorldtask.getWorldtask(uid)
|
myWorldtask, err := a.module.modelWorldtask.getWorldtask(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.module.Error("获取玩家世界任务失败", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err.Error()})
|
a.module.Error("获取玩家世界任务失败", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err.Error()})
|
||||||
@ -34,6 +40,19 @@ func (a *apiComp) Accept(session comm.IUserSession, req *pb.WorldtaskAcceptReq)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断玩家等级要求
|
||||||
|
if user.Lv < curTaskConf.Lock {
|
||||||
|
code = pb.ErrorCode_WorldtaskLvNotEnough
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 前置任务ID 只有世界任务才校验前置
|
||||||
|
if !a.module.modelWorldtask.IsPreFinished(req.GroupId, myWorldtask, curTaskConf) {
|
||||||
|
a.module.Debug("前置任务未完成", log.Field{Key: "uid", Value: uid}, log.Field{Key: "preTaskId", Value: curTaskConf.Ontxe}, log.Field{Key: "taskId", Value: curTaskConf.Key})
|
||||||
|
code = pb.ErrorCode_WorldtaskLastUnFinished
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if myWorldtask.CurrentTask == nil {
|
if myWorldtask.CurrentTask == nil {
|
||||||
myWorldtask.CurrentTask = make(map[int32]*pb.Worldtask)
|
myWorldtask.CurrentTask = make(map[int32]*pb.Worldtask)
|
||||||
}
|
}
|
||||||
@ -58,8 +77,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)
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
@ -184,18 +184,17 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
|||||||
} else {
|
} else {
|
||||||
// 章节完成
|
// 章节完成
|
||||||
if _, ok := userTask.Chapters[req.GroupId]; !ok {
|
if _, ok := userTask.Chapters[req.GroupId]; !ok {
|
||||||
|
delete(userTask.CurrentTask, req.GroupId)
|
||||||
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 //已解锁待领取
|
|
||||||
update := map[string]interface{}{
|
|
||||||
"chapters": userTask.Chapters,
|
|
||||||
"currentTask": userTask.CurrentTask,
|
|
||||||
}
|
|
||||||
this.module.modelWorldtask.Change(uid, update)
|
|
||||||
}
|
}
|
||||||
|
userTask.Chapters[req.GroupId] = 1 //已解锁待领取
|
||||||
|
update := map[string]interface{}{
|
||||||
|
"chapters": userTask.Chapters,
|
||||||
|
"currentTask": userTask.CurrentTask,
|
||||||
|
}
|
||||||
|
this.module.modelWorldtask.Change(uid, update)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
@ -15,6 +21,13 @@ func (this *apiComp) MineCheck(session comm.IUserSession, req *pb.WorldtaskMineR
|
|||||||
|
|
||||||
func (this *apiComp) Mine(session comm.IUserSession, req *pb.WorldtaskMineReq) (code pb.ErrorCode, data proto.Message) {
|
func (this *apiComp) Mine(session comm.IUserSession, req *pb.WorldtaskMineReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
|
|
||||||
|
user := this.module.ModuleUser.GetUser(uid)
|
||||||
|
if user == nil {
|
||||||
|
code = pb.ErrorCode_UserNofound
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
myWorldtask, err := this.module.modelWorldtask.getWorldtask(uid)
|
myWorldtask, err := this.module.modelWorldtask.getWorldtask(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.module.Error("获取玩家世界任务失败", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err.Error()})
|
this.module.Error("获取玩家世界任务失败", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err.Error()})
|
||||||
@ -22,6 +35,52 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.WorldtaskMineReq) (
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if myWorldtask.CurrentTask == nil {
|
||||||
|
myWorldtask.CurrentTask = make(map[int32]*pb.Worldtask)
|
||||||
|
}
|
||||||
|
|
||||||
|
now := configure.Now().Unix()
|
||||||
|
update := make(map[string]interface{})
|
||||||
|
|
||||||
|
// 日常
|
||||||
|
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()
|
||||||
|
}
|
||||||
|
|
||||||
|
//周常
|
||||||
|
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
|
||||||
|
|
||||||
|
if err := this.module.modelWorldtask.Change(uid, update); err != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
rsp := &pb.WorldtaskMineResp{
|
rsp := &pb.WorldtaskMineResp{
|
||||||
Task: myWorldtask,
|
Task: myWorldtask,
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
|
"go_dreamfactory/utils"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
)
|
)
|
||||||
@ -206,6 +207,7 @@ func (this *ModelWorldtask) updateCheckCond(uid string, userTask *pb.DBWorldtask
|
|||||||
return userTask
|
return userTask
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 任务完成推送
|
||||||
func (this *ModelWorldtask) taskFinishPush(session comm.IUserSession, groupId int32, userTask *pb.DBWorldtask, curTaskConf *cfg.GameWorldTaskData) {
|
func (this *ModelWorldtask) taskFinishPush(session comm.IUserSession, groupId int32, userTask *pb.DBWorldtask, curTaskConf *cfg.GameWorldTaskData) {
|
||||||
nextTaskIds := this.findNextTasks(curTaskConf.Key)
|
nextTaskIds := this.findNextTasks(curTaskConf.Key)
|
||||||
this.moduleWorldtask.Debug("nextTaskIds", log.Field{Key: "nextTaskIds", Value: nextTaskIds})
|
this.moduleWorldtask.Debug("nextTaskIds", log.Field{Key: "nextTaskIds", Value: nextTaskIds})
|
||||||
@ -229,16 +231,16 @@ func (this *ModelWorldtask) taskFinishPush(session comm.IUserSession, groupId in
|
|||||||
if curTaskConf.IdAfter == 0 {
|
if curTaskConf.IdAfter == 0 {
|
||||||
// 章节完成
|
// 章节完成
|
||||||
if _, ok := userTask.Chapters[groupId]; !ok {
|
if _, ok := userTask.Chapters[groupId]; !ok {
|
||||||
|
delete(userTask.CurrentTask, groupId)
|
||||||
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 //已解锁待领取
|
|
||||||
update := map[string]interface{}{
|
|
||||||
"chapters": userTask.Chapters,
|
|
||||||
"currentTask": userTask.CurrentTask,
|
|
||||||
}
|
|
||||||
this.Change(session.GetUserId(), update)
|
|
||||||
}
|
}
|
||||||
|
userTask.Chapters[groupId] = 1 //已解锁待领取
|
||||||
|
update := map[string]interface{}{
|
||||||
|
"chapters": userTask.Chapters,
|
||||||
|
"currentTask": userTask.CurrentTask,
|
||||||
|
}
|
||||||
|
this.Change(session.GetUserId(), update)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,6 +251,7 @@ func (this *ModelWorldtask) taskFinishPush(session comm.IUserSession, groupId in
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 任务完成
|
||||||
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) {
|
||||||
if err := this.finishTask(groupId, taskId, userTask); err != nil {
|
if err := this.finishTask(groupId, taskId, userTask); err != nil {
|
||||||
this.moduleWorldtask.Error("完成任务失败",
|
this.moduleWorldtask.Error("完成任务失败",
|
||||||
@ -273,5 +276,49 @@ func (this *ModelWorldtask) taskFinish(session comm.IUserSession, groupId, taskI
|
|||||||
ic.TaskComplete(session, taskId)
|
ic.TaskComplete(session, taskId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Worldtask) filterTask(userLv, des int32, wt *pb.DBWorldtask) (taskIds []int32) {
|
||||||
|
if des != 1 && des != 4 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
gwt, err := this.configure.getWorldtaskCfg()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range gwt.GetDataList() {
|
||||||
|
// 主角等级
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 随机日常、周常任务
|
||||||
|
func (this *Worldtask) randomTask(userLv, des int32, wt *pb.DBWorldtask) (taskIds []int32) {
|
||||||
|
var num int32
|
||||||
|
if des == 1 {
|
||||||
|
num = this.configure.GetGlobalConf().DailyNum
|
||||||
|
} else if des == 4 {
|
||||||
|
num = this.configure.GetGlobalConf().WeekNum
|
||||||
|
}
|
||||||
|
|
||||||
|
tIds := this.filterTask(userLv, des, wt)
|
||||||
|
if len(tIds) < int(num) {
|
||||||
|
num = int32(len(tIds))
|
||||||
|
}
|
||||||
|
idx := utils.RandomNumbers(0, len(tIds), int(num))
|
||||||
|
|
||||||
|
for i := 0; i < len(idx); i++ {
|
||||||
|
taskIds = append(taskIds, tIds[i])
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
@ -131,107 +131,6 @@ func (this *Worldtask) TaskCondFinishNotify(session comm.IUserSession, condId in
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 任务条件达成通知
|
|
||||||
// Deprecated
|
|
||||||
// func (this *Worldtask) TaskcondNotify(session comm.IUserSession, condId int32) error {
|
|
||||||
// uid := session.GetUserId()
|
|
||||||
|
|
||||||
// finishedTaskIds := make(map[int32]int32) //达成的任务条件
|
|
||||||
// for _, c := range this.worldtaskConf.GetDataList() {
|
|
||||||
// for _, v := range c.Completetask {
|
|
||||||
// if v == condId {
|
|
||||||
// finishedTaskIds[c.Group] = c.Key
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if len(finishedTaskIds) == 0 {
|
|
||||||
// //this.Debug("没有匹配到任务世界任务", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "condId", Value: condId})
|
|
||||||
// return nil
|
|
||||||
// }
|
|
||||||
// this.Debug("世界任务完成通知-查找到世界任务", log.Field{Key: "uid", Value: uid}, log.Field{Key: "condId", Value: condId}, log.Field{Key: "params", Value: finishedTaskIds})
|
|
||||||
// //下一个任务ID
|
|
||||||
// var nextTaskId int32
|
|
||||||
// // 获取用户信息
|
|
||||||
// user := this.ModuleUser.GetUser(uid)
|
|
||||||
// if user == nil {
|
|
||||||
// return comm.NewCustomError(pb.ErrorCode_UserSessionNobeing)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 玩家世界任务
|
|
||||||
// userTask, err := this.modelWorldtask.getWorldtask(uid)
|
|
||||||
// if err != nil {
|
|
||||||
// this.Error("获取玩家世界任务", log.Field{Key: "uid", Value: uid}, log.Field{Key: "condId", Value: condId})
|
|
||||||
// return err
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if userTask.Uid != "" {
|
|
||||||
// //查找任务ID根据condId 可能会找出不同的任务
|
|
||||||
// for groupId, taskId := range finishedTaskIds {
|
|
||||||
// logFields := []log.Field{{Key: "uid", Value: uid}, {Key: "group", Value: groupId}, {Key: "taskId", Value: taskId}, {Key: "condId", Value: condId}}
|
|
||||||
// // 判断任务是否已完成
|
|
||||||
// if this.modelWorldtask.isFinished(taskId, userTask.TaskList) {
|
|
||||||
// this.Debug("世界任务已完成", logFields...)
|
|
||||||
// continue
|
|
||||||
// }
|
|
||||||
// taskConf, err := this.configure.getWorldtaskById(taskId)
|
|
||||||
// if err != nil {
|
|
||||||
// this.Error("world_task config not found", logFields...)
|
|
||||||
// return err
|
|
||||||
// }
|
|
||||||
// logFields = append(logFields, log.Field{Key: "id_after", Value: taskConf.IdAfter}, log.Field{Key: "des", Value: taskConf.Des})
|
|
||||||
// if taskConf != nil {
|
|
||||||
// if taskConf.Des == 2 { //只有世界任务才校验前置
|
|
||||||
// if !this.modelWorldtask.IsPreFinished(userTask, taskConf) {
|
|
||||||
// this.Debug("世界任务前置任务未完成", logFields...)
|
|
||||||
// continue
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// nextTaskId = taskConf.IdAfter
|
|
||||||
|
|
||||||
// // 判断玩家等级要求
|
|
||||||
// if taskConf.Des == 2 {
|
|
||||||
// if user.Lv < taskConf.Lock {
|
|
||||||
// logFields = append(logFields, log.Field{Key: "当前lv", Value: user.Lv}, log.Field{Key: "期望等级", Value: taskConf.Lock})
|
|
||||||
// this.Debug("等级不满足", logFields...)
|
|
||||||
// return comm.NewCustomError(pb.ErrorCode_WorldtaskLvNotEnough)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //完成任务
|
|
||||||
// if err := this.modelWorldtask.finishTask(groupId, taskId, userTask); err != nil {
|
|
||||||
// logFields = append(logFields, log.Field{Key: "err", Value: err.Error()})
|
|
||||||
// this.Error("世界任务完成", logFields...)
|
|
||||||
// return err
|
|
||||||
// }
|
|
||||||
// this.Debug("任务条件达成完成", logFields...)
|
|
||||||
// //发奖
|
|
||||||
// if code := this.DispenseRes(session, taskConf.Reword, true); code != pb.ErrorCode_Success {
|
|
||||||
// logFields = append(logFields, log.Field{Key: "reward", Value: taskConf.Reword}, log.Field{Key: "code", Value: code})
|
|
||||||
// this.Error("资源发放", logFields...)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if nextTaskId != 0 && taskConf.Des == 2 {
|
|
||||||
// if err := session.SendMsg(string(this.GetType()), "nexttask", &pb.WorldtaskNexttaskPush{
|
|
||||||
// // NextTaskId: nextTaskId,
|
|
||||||
// }); err != nil {
|
|
||||||
// logFields = append(logFields, log.Field{Key: "err", Value: err.Error()})
|
|
||||||
// log.Error("任务条件达成推送", logFields...)
|
|
||||||
// } else {
|
|
||||||
// this.Debug("推送任务", log.Field{Key: "NextTaskId", Value: nextTaskId})
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// this.Debug("已经是最后一个任务了", logFields...)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return nil
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 获取我的世界任务
|
// 获取我的世界任务
|
||||||
func (this *Worldtask) GetMyWorldtask(uid string) *pb.DBWorldtask {
|
func (this *Worldtask) GetMyWorldtask(uid string) *pb.DBWorldtask {
|
||||||
wt, err := this.modelWorldtask.getWorldtask(uid)
|
wt, err := this.modelWorldtask.getWorldtask(uid)
|
||||||
|
@ -25,10 +25,12 @@ type DBWorldtask struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` //玩家ID
|
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` //玩家ID
|
||||||
TaskList []int32 `protobuf:"varint,3,rep,packed,name=taskList,proto3" json:"taskList" bson:"taskList"` // 任务列表
|
TaskList []int32 `protobuf:"varint,3,rep,packed,name=taskList,proto3" json:"taskList" bson:"taskList"` // 任务列表
|
||||||
CurrentTask map[int32]*Worldtask `protobuf:"bytes,4,rep,name=currentTask,proto3" json:"currentTask" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" bson:"currentTask"` //正在进行的任务
|
CurrentTask map[int32]*Worldtask `protobuf:"bytes,4,rep,name=currentTask,proto3" json:"currentTask" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" bson:"currentTask"` //正在进行的任务
|
||||||
Chapters map[int32]int32 `protobuf:"bytes,5,rep,name=chapters,proto3" json:"chapters" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"chapters"` //key章节ID v状态 1已解锁2已领取
|
Chapters map[int32]int32 `protobuf:"bytes,5,rep,name=chapters,proto3" json:"chapters" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"chapters"` //key章节ID v状态 1已解锁2已领取
|
||||||
|
DaliyRefreshTime int64 `protobuf:"varint,6,opt,name=daliyRefreshTime,proto3" json:"daliyRefreshTime" bson:"daliyRefreshTime"`
|
||||||
|
WeekRefreshTime int64 `protobuf:"varint,7,opt,name=weekRefreshTime,proto3" json:"weekRefreshTime" bson:"weekRefreshTime"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBWorldtask) Reset() {
|
func (x *DBWorldtask) Reset() {
|
||||||
@ -91,6 +93,20 @@ func (x *DBWorldtask) GetChapters() map[int32]int32 {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *DBWorldtask) GetDaliyRefreshTime() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.DaliyRefreshTime
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBWorldtask) GetWeekRefreshTime() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.WeekRefreshTime
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
type Worldtask struct {
|
type Worldtask struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@ -174,8 +190,8 @@ var File_worldtask_worldtask_db_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
var file_worldtask_worldtask_db_proto_rawDesc = []byte{
|
var file_worldtask_worldtask_db_proto_rawDesc = []byte{
|
||||||
0x0a, 0x1c, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x2f, 0x77, 0x6f, 0x72, 0x6c,
|
0x0a, 0x1c, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x2f, 0x77, 0x6f, 0x72, 0x6c,
|
||||||
0x64, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd,
|
0x64, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x93,
|
||||||
0x02, 0x0a, 0x0b, 0x44, 0x42, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x12, 0x10,
|
0x03, 0x0a, 0x0b, 0x44, 0x42, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x12, 0x10,
|
||||||
0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64,
|
0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64,
|
||||||
0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03,
|
0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03,
|
||||||
0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x0b,
|
0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x0b,
|
||||||
@ -186,26 +202,31 @@ var file_worldtask_worldtask_db_proto_rawDesc = []byte{
|
|||||||
0x08, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
0x08, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
||||||
0x1a, 0x2e, 0x44, 0x42, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x2e, 0x43, 0x68,
|
0x1a, 0x2e, 0x44, 0x42, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x2e, 0x43, 0x68,
|
||||||
0x61, 0x70, 0x74, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x63, 0x68, 0x61,
|
0x61, 0x70, 0x74, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x63, 0x68, 0x61,
|
||||||
0x70, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x4a, 0x0a, 0x10, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74,
|
0x70, 0x74, 0x65, 0x72, 0x73, 0x12, 0x2a, 0x0a, 0x10, 0x64, 0x61, 0x6c, 0x69, 0x79, 0x52, 0x65,
|
||||||
0x54, 0x61, 0x73, 0x6b, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
|
0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x05, 0x76,
|
0x10, 0x64, 0x61, 0x6c, 0x69, 0x79, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x69, 0x6d,
|
||||||
0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x57, 0x6f, 0x72,
|
0x65, 0x12, 0x28, 0x0a, 0x0f, 0x77, 0x65, 0x65, 0x6b, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68,
|
||||||
0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38,
|
0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x77, 0x65, 0x65, 0x6b,
|
||||||
0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74,
|
0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x1a, 0x4a, 0x0a, 0x10, 0x43,
|
||||||
0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
|
0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12,
|
||||||
0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20,
|
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65,
|
||||||
0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x99,
|
0x79, 0x12, 0x20, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
|
||||||
0x01, 0x0a, 0x09, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x12, 0x16, 0x0a, 0x06,
|
0x32, 0x0a, 0x2e, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x05, 0x76, 0x61,
|
||||||
0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61,
|
0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x43, 0x68, 0x61, 0x70, 0x74,
|
||||||
0x73, 0x6b, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65,
|
0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
|
||||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65,
|
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
|
||||||
0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20,
|
0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
||||||
0x01, 0x28, 0x05, 0x52, 0x09, 0x6e, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a,
|
0x3a, 0x02, 0x38, 0x01, 0x22, 0x99, 0x01, 0x0a, 0x09, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61,
|
||||||
0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x49, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x05,
|
0x73, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||||
0x52, 0x08, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x49, 0x64, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65,
|
0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61,
|
||||||
0x6c, 0x69, 0x76, 0x65, 0x72, 0x4e, 0x70, 0x63, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a,
|
0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x74, 0x61,
|
||||||
0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x4e, 0x70, 0x63, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
|
0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x70, 0x63, 0x53, 0x74, 0x61,
|
||||||
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6e, 0x70, 0x63, 0x53, 0x74,
|
||||||
|
0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x49, 0x64, 0x73,
|
||||||
|
0x18, 0x06, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x49, 0x64, 0x73,
|
||||||
|
0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x4e, 0x70, 0x63, 0x18, 0x07,
|
||||||
|
0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x4e, 0x70, 0x63,
|
||||||
|
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
Loading…
Reference in New Issue
Block a user