diff --git a/modules/user/module.go b/modules/user/module.go index b67203801..1d3a8cec6 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -524,6 +524,10 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha } change.Arenacoin += add case comm.ResPs: + ggd := this.ModuleTools.GetGlobalConf() + if ggd == nil { + return + } if add < 0 { if user.Ps+add < 0 { errdata = &pb.ErrorData{ @@ -532,11 +536,11 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha } return } + //体力消耗,增加玩家经验 + // exp := int32(math.Abs(float64(add))) * ggd.FightPs + // user.Exp += int64(exp) } - ggd := this.ModuleTools.GetGlobalConf() - if ggd == nil { - return - } + if change.Ps+add > ggd.PsUl { errdata = &pb.ErrorData{ Code: pb.ErrorCode_UserVitLimit, diff --git a/modules/worldtask/api_accept.go b/modules/worldtask/api_accept.go index 2857f3ad9..7c7bf4047 100644 --- a/modules/worldtask/api_accept.go +++ b/modules/worldtask/api_accept.go @@ -101,26 +101,25 @@ func (a *apiComp) Accept(session comm.IUserSession, req *pb.WorldtaskAcceptReq) break } } - } - // else { - // tasks = &pb.Worldtasks{ - // TaskMap: make(map[int32]*pb.Worldtask), - // } - // task := &pb.Worldtask{ - // TaskId: req.TaskId, - // TaskType: curTaskConf.Des, - // NpcStatus: 1, //接取 - // } + } else { + tasks = &pb.Worldtasks{ + TaskMap: make(map[int32]*pb.Worldtask), + } + task := &pb.Worldtask{ + TaskId: req.TaskId, + TaskType: curTaskConf.Des, + NpcStatus: 1, //接取 + } - // for _, cid := range curTaskConf.Completetask { - // task.Conds = append(task.Conds, &pb.ConIProgress{ - // Conid: cid, - // }) - // } + for _, cid := range curTaskConf.Completetask { + task.Conds = append(task.Conds, &pb.ConIProgress{ + Conid: cid, + }) + } - // tasks.TaskMap[req.TaskId] = task - // myWorldtask.CurrentTasks[curTaskConf.Group] = tasks - // } + tasks.TaskMap[req.TaskId] = task + myWorldtask.CurrentTasks[curTaskConf.Group] = tasks + } update := map[string]interface{}{ "currentTasks": myWorldtask.CurrentTasks,