Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
1a2d39eaec
@ -6261,7 +6261,7 @@
|
||||
"type_sp": 1,
|
||||
"tasktxt": {
|
||||
"key": "taskcond_rdtask_condi_tasktxt_369",
|
||||
"text": "强化武器+3(引导自动强化)"
|
||||
"text": "强化任意装备3次"
|
||||
},
|
||||
"type": 92,
|
||||
"valid": 0,
|
||||
@ -6295,7 +6295,7 @@
|
||||
"type_sp": 1,
|
||||
"tasktxt": {
|
||||
"key": "taskcond_rdtask_condi_tasktxt_371",
|
||||
"text": "通关1次维京远征boss2难度1"
|
||||
"text": "通关维京远征boss2难度1"
|
||||
},
|
||||
"type": 73,
|
||||
"valid": 0,
|
||||
@ -8119,9 +8119,9 @@
|
||||
"type": 93,
|
||||
"valid": 0,
|
||||
"NPC": 10291,
|
||||
"data1": 6,
|
||||
"data2": 1,
|
||||
"data3": 0,
|
||||
"data1": 1,
|
||||
"data2": 6,
|
||||
"data3": 1,
|
||||
"data4": 0,
|
||||
"data5": 0
|
||||
},
|
||||
|
@ -64,9 +64,11 @@ func (this *BingoView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
var bingo string
|
||||
if ttxt == "" && nEntry.Text == "" {
|
||||
bingo = fmt.Sprintf("bingo:%s", aSel.Selected)
|
||||
} else if ttxt == "" {
|
||||
} else if ttxt != "" && nEntry.Text == "" {
|
||||
bingo = fmt.Sprintf("bingo:%s,%s", aSel.Selected, ttxt)
|
||||
} else if ttxt == "" && nEntry.Text != "" {
|
||||
bingo = fmt.Sprintf("bingo:%s,%s", aSel.Selected, nEntry.Text)
|
||||
} else {
|
||||
} else if ttxt != "" && nEntry.Text != "" {
|
||||
bingo = fmt.Sprintf("bingo:%s,%s,%s", aSel.Selected, ttxt, nEntry.Text)
|
||||
}
|
||||
logrus.Info(bingo)
|
||||
|
@ -396,6 +396,8 @@ type (
|
||||
TaskCondFinishNotify(session IUserSession, condIds []int32) error
|
||||
// bingo任务
|
||||
BingoJumpTask(session IUserSession, groupId, rtaskId int32) error
|
||||
// 通过任务ID bingo
|
||||
JumpTaskByTaskId(session IUserSession, rtaskId int32) error
|
||||
// 查询我的世界任务
|
||||
GetMyWorldtask(uid string) *pb.DBWorldtask
|
||||
// 获取分组任务
|
||||
|
@ -162,6 +162,19 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
||||
)
|
||||
}
|
||||
}
|
||||
} else if len(datas) == 2 && (datas[0] == "worldtask") {
|
||||
module, err := this.service.GetModule(comm.ModuleWorldtask)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if wt, ok := module.(comm.IWorldtask); ok {
|
||||
if err = wt.JumpTaskByTaskId(session, utils.ToInt32(datas[1])); err != nil {
|
||||
this.Error("bingo 世界任务",
|
||||
log.Field{Key: "params", Value: datas},
|
||||
log.Field{Key: "err", Value: err.Error()},
|
||||
)
|
||||
}
|
||||
}
|
||||
} else if len(datas) == 1 && (datas[0] == "manhero") { // 获取满星、等级、觉醒、共鸣技能
|
||||
module1, err := this.service.GetModule(comm.ModuleHero)
|
||||
if err != nil {
|
||||
|
@ -283,7 +283,10 @@ func (this *ModuleRtask) processOneTask(session comm.IUserSession, record *pb.DB
|
||||
if len(params) == 1 {
|
||||
ok = true
|
||||
} else {
|
||||
ok, d, _ = handle.verify(uid, conf, params...)
|
||||
ok, d, err = handle.verify(uid, conf, params...)
|
||||
if err != nil {
|
||||
// this.Error("参数校验失败", log.Field{Key: "err", Value: err.Error()})
|
||||
}
|
||||
}
|
||||
|
||||
if !ok {
|
||||
|
@ -2,20 +2,20 @@
|
||||
package rtask
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"go_dreamfactory/utils"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
|
||||
// n params (1-GreatEqual 2-equal 3-equal 4-equal 5-equal)
|
||||
func (this *ModelRtaskRecord) verifyMultiEqual(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
|
||||
if len(params) == 0 {
|
||||
err = errors.New("玩家参数数据缺失")
|
||||
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
|
||||
return
|
||||
}
|
||||
var paramLen int
|
||||
@ -89,17 +89,18 @@ func (this *ModelRtaskRecord) verifyFirstEqualParam(uid string, cfg *cfg.GameRdt
|
||||
|
||||
// firstParam (first-greatEqual)
|
||||
func (this *ModelRtaskRecord) verifyFirstGreatEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
|
||||
if len(params) == 1 {
|
||||
ok = true
|
||||
// ok, err = soGreatEqual(params[0], cfg.Data1)
|
||||
if len(params) != 1 {
|
||||
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
|
||||
return
|
||||
}
|
||||
ok = true
|
||||
return
|
||||
}
|
||||
|
||||
// three params (first-greatEqual second-equal third-lessEqual)
|
||||
func (this *ModelRtaskRecord) verifyThirdLessEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
|
||||
if len(params) != 3 {
|
||||
err = errors.New("玩家参数数据缺失")
|
||||
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
|
||||
return
|
||||
}
|
||||
var paramLen int
|
||||
@ -128,7 +129,7 @@ func (this *ModelRtaskRecord) verifyThirdLessEqualParam(uid string, cfg *cfg.Gam
|
||||
// three params (first-greatEqual second-equal third-greatEqual)
|
||||
func (this *ModelRtaskRecord) verifyThirdGreatEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
|
||||
if len(params) != 3 {
|
||||
err = errors.New("玩家参数数据缺失")
|
||||
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
|
||||
return
|
||||
}
|
||||
var paramLen int
|
||||
@ -157,20 +158,11 @@ func (this *ModelRtaskRecord) verifyThirdGreatEqualParam(uid string, cfg *cfg.Ga
|
||||
// two params (first-Equal second-Equal)
|
||||
func (this *ModelRtaskRecord) veriftyEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
|
||||
if len(params) != 2 {
|
||||
err = errors.New("玩家参数数据缺失")
|
||||
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
|
||||
return
|
||||
}
|
||||
// var paramLen int
|
||||
if _, err = lenParam(cfg, params...); err == nil {
|
||||
//参数比较,默认第一个参数soGreateEqual,其它soEqual
|
||||
// switch paramLen {
|
||||
// case 1:
|
||||
// ok, err = soGreat(params[0], cfg.Data1)
|
||||
// return
|
||||
// case 2:
|
||||
// if ok, err = soGreat(params[0], cfg.Data1); !ok {
|
||||
// return
|
||||
// }
|
||||
if ok, err = soEqual(params[1], cfg.Data2); !ok {
|
||||
return
|
||||
}
|
||||
@ -182,7 +174,7 @@ func (this *ModelRtaskRecord) veriftyEqualParam(uid string, cfg *cfg.GameRdtaskC
|
||||
// two params (first-Equal second-GreatEqual)
|
||||
func (this *ModelRtaskRecord) veriftyGreatEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
|
||||
if len(params) != 2 {
|
||||
err = errors.New("玩家参数数据缺失")
|
||||
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
|
||||
return
|
||||
}
|
||||
// var paramLen int
|
||||
|
@ -192,7 +192,7 @@ func (this *Worldtask) BingoJumpTask(session comm.IUserSession, groupId, taskId
|
||||
//遍历
|
||||
if taskConf.Ontxe != 0 && taskConf.IdAfter != 0 {
|
||||
for _, v := range this.worldtaskConf.GetDataList() {
|
||||
if v.Group == groupId && v.Key <= taskId && v.Des == 2 { //只做主线的des=2
|
||||
if v.Group == groupId && v.Key <= taskId && v.Des == 2 {
|
||||
mytask.TaskList = append(mytask.TaskList, v.Key)
|
||||
}
|
||||
}
|
||||
@ -204,7 +204,7 @@ func (this *Worldtask) BingoJumpTask(session comm.IUserSession, groupId, taskId
|
||||
"taskList": mytask.TaskList,
|
||||
}
|
||||
|
||||
//当前任务
|
||||
//下个任务
|
||||
nextTaskIds := this.modelWorldtask.findNextTasks(taskId)
|
||||
|
||||
if mytask.CurrentTask == nil {
|
||||
@ -228,6 +228,73 @@ func (this *Worldtask) BingoJumpTask(session comm.IUserSession, groupId, taskId
|
||||
return session.SendMsg(string(this.GetType()), "finishids", rsp)
|
||||
}
|
||||
|
||||
// 通过任务ID bingo
|
||||
func (this *Worldtask) JumpTaskByTaskId(session comm.IUserSession, taskId int32) error {
|
||||
uid := session.GetUserId()
|
||||
//查询当前世界任务数据
|
||||
mytask, err := this.modelWorldtask.getWorldtask(uid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 如果是空 或Uid是空 初始一条基础数据
|
||||
if mytask == nil {
|
||||
mytask = &pb.DBWorldtask{}
|
||||
mytask.Uid = uid
|
||||
if err := this.modelWorldtask.Add(uid, mytask); err != nil {
|
||||
this.Error("添加世界任务失败", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err})
|
||||
return err
|
||||
}
|
||||
} else if mytask.Uid == "" {
|
||||
update := map[string]interface{}{
|
||||
"uid": uid,
|
||||
}
|
||||
if err := this.modelWorldtask.Change(uid, update); err != nil {
|
||||
this.Error("更新世界任务失败", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err})
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
//重置taskList
|
||||
mytask.TaskList = []int32{}
|
||||
// 判断任务ID是否已完成
|
||||
// if _, ok := utils.Findx(mytask.TaskList, taskId); ok {
|
||||
// this.Error("GM 世界任务已完成", log.Field{Key: "taskId", Value: taskId})
|
||||
// return comm.NewCustomError(pb.ErrorCode_WorldtaskFinihed)
|
||||
// }
|
||||
|
||||
// 获取当前bingo的任务配置
|
||||
taskConf := this.worldtaskConf.GetDataMap()[taskId]
|
||||
if taskConf == nil {
|
||||
return comm.NewCustomError(pb.ErrorCode_ConfigNoFound)
|
||||
}
|
||||
|
||||
// 返回所有前置任务
|
||||
mytask.TaskList = this.recursionTasks(taskId)
|
||||
|
||||
update := map[string]interface{}{
|
||||
"taskList": mytask.TaskList,
|
||||
}
|
||||
|
||||
if mytask.CurrentTask == nil {
|
||||
mytask.CurrentTask = make(map[int32]*pb.Worldtask)
|
||||
}
|
||||
|
||||
mytask.CurrentTask[taskConf.Group] = &pb.Worldtask{
|
||||
TaskId: taskId,
|
||||
TaskType: taskConf.Des,
|
||||
}
|
||||
update["currentTask"] = mytask.CurrentTask
|
||||
|
||||
if err := this.modelWorldtask.Change(uid, update); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rsp := &pb.WorldtaskFinishIdsPush{}
|
||||
|
||||
return session.SendMsg(string(this.GetType()), "finishids", rsp)
|
||||
}
|
||||
|
||||
// 返回任务ID
|
||||
func (this *Worldtask) GetWorldTaskBy(session comm.IUserSession, groupId int32) (taskId int32) {
|
||||
uid := session.GetUserId()
|
||||
@ -334,6 +401,15 @@ func (this *Worldtask) UpdateTaskStatus(uid string, taskId int32) {
|
||||
}
|
||||
}
|
||||
|
||||
func (this *Worldtask) ConditionFinishNotify(uid string, condIds []int32) {
|
||||
|
||||
func (this *Worldtask) recursionTasks(taskId int32) (taskIds []int32) {
|
||||
if taskConf, ok := this.worldtaskConf.GetDataMap()[taskId]; ok {
|
||||
preId := taskConf.Ontxe
|
||||
for preId > 0 {
|
||||
if tc, ok := this.worldtaskConf.GetDataMap()[preId]; ok {
|
||||
taskIds = append(taskIds, preId)
|
||||
preId = tc.Ontxe
|
||||
}
|
||||
}
|
||||
}
|
||||
return taskIds
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user