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,
|
"type_sp": 1,
|
||||||
"tasktxt": {
|
"tasktxt": {
|
||||||
"key": "taskcond_rdtask_condi_tasktxt_369",
|
"key": "taskcond_rdtask_condi_tasktxt_369",
|
||||||
"text": "强化武器+3(引导自动强化)"
|
"text": "强化任意装备3次"
|
||||||
},
|
},
|
||||||
"type": 92,
|
"type": 92,
|
||||||
"valid": 0,
|
"valid": 0,
|
||||||
@ -6295,7 +6295,7 @@
|
|||||||
"type_sp": 1,
|
"type_sp": 1,
|
||||||
"tasktxt": {
|
"tasktxt": {
|
||||||
"key": "taskcond_rdtask_condi_tasktxt_371",
|
"key": "taskcond_rdtask_condi_tasktxt_371",
|
||||||
"text": "通关1次维京远征boss2难度1"
|
"text": "通关维京远征boss2难度1"
|
||||||
},
|
},
|
||||||
"type": 73,
|
"type": 73,
|
||||||
"valid": 0,
|
"valid": 0,
|
||||||
@ -8119,9 +8119,9 @@
|
|||||||
"type": 93,
|
"type": 93,
|
||||||
"valid": 0,
|
"valid": 0,
|
||||||
"NPC": 10291,
|
"NPC": 10291,
|
||||||
"data1": 6,
|
"data1": 1,
|
||||||
"data2": 1,
|
"data2": 6,
|
||||||
"data3": 0,
|
"data3": 1,
|
||||||
"data4": 0,
|
"data4": 0,
|
||||||
"data5": 0
|
"data5": 0
|
||||||
},
|
},
|
||||||
|
@ -64,9 +64,11 @@ func (this *BingoView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
|||||||
var bingo string
|
var bingo string
|
||||||
if ttxt == "" && nEntry.Text == "" {
|
if ttxt == "" && nEntry.Text == "" {
|
||||||
bingo = fmt.Sprintf("bingo:%s", aSel.Selected)
|
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)
|
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)
|
bingo = fmt.Sprintf("bingo:%s,%s,%s", aSel.Selected, ttxt, nEntry.Text)
|
||||||
}
|
}
|
||||||
logrus.Info(bingo)
|
logrus.Info(bingo)
|
||||||
|
@ -396,6 +396,8 @@ type (
|
|||||||
TaskCondFinishNotify(session IUserSession, condIds []int32) error
|
TaskCondFinishNotify(session IUserSession, condIds []int32) error
|
||||||
// bingo任务
|
// bingo任务
|
||||||
BingoJumpTask(session IUserSession, groupId, rtaskId int32) error
|
BingoJumpTask(session IUserSession, groupId, rtaskId int32) error
|
||||||
|
// 通过任务ID bingo
|
||||||
|
JumpTaskByTaskId(session IUserSession, rtaskId int32) error
|
||||||
// 查询我的世界任务
|
// 查询我的世界任务
|
||||||
GetMyWorldtask(uid string) *pb.DBWorldtask
|
GetMyWorldtask(uid string) *pb.DBWorldtask
|
||||||
// 获取分组任务
|
// 获取分组任务
|
||||||
|
@ -33,33 +33,33 @@ type GM struct {
|
|||||||
configure *configureComp
|
configure *configureComp
|
||||||
}
|
}
|
||||||
|
|
||||||
//模块名
|
// 模块名
|
||||||
func (this *GM) GetType() core.M_Modules {
|
func (this *GM) GetType() core.M_Modules {
|
||||||
return comm.ModuleGM
|
return comm.ModuleGM
|
||||||
}
|
}
|
||||||
|
|
||||||
//模块初始化接口 注册用户创建角色事件
|
// 模块初始化接口 注册用户创建角色事件
|
||||||
func (this *GM) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
func (this *GM) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||||
err = this.ModuleBase.Init(service, module, options)
|
err = this.ModuleBase.Init(service, module, options)
|
||||||
this.service = service.(base.IRPCXService)
|
this.service = service.(base.IRPCXService)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//模块初始化接口 注册用户创建角色事件
|
// 模块初始化接口 注册用户创建角色事件
|
||||||
func (this *GM) Start() (err error) {
|
func (this *GM) Start() (err error) {
|
||||||
err = this.ModuleBase.Start()
|
err = this.ModuleBase.Start()
|
||||||
this.service.RegisterFunctionName(string(comm.Rpc_ModuleGMCreateCmd), this.Rpc_ModuleGMCreateCmd)
|
this.service.RegisterFunctionName(string(comm.Rpc_ModuleGMCreateCmd), this.Rpc_ModuleGMCreateCmd)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//装备组件
|
// 装备组件
|
||||||
func (this *GM) OnInstallComp() {
|
func (this *GM) OnInstallComp() {
|
||||||
this.ModuleBase.OnInstallComp()
|
this.ModuleBase.OnInstallComp()
|
||||||
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
|
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||||
}
|
}
|
||||||
|
|
||||||
//bingo:Iamyoudad
|
// bingo:Iamyoudad
|
||||||
func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorCode) {
|
func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorCode) {
|
||||||
|
|
||||||
cmd = strings.Replace(cmd, " ", "", -1) // 去空格
|
cmd = strings.Replace(cmd, " ", "", -1) // 去空格
|
||||||
@ -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") { // 获取满星、等级、觉醒、共鸣技能
|
} else if len(datas) == 1 && (datas[0] == "manhero") { // 获取满星、等级、觉醒、共鸣技能
|
||||||
module1, err := this.service.GetModule(comm.ModuleHero)
|
module1, err := this.service.GetModule(comm.ModuleHero)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -283,7 +283,10 @@ func (this *ModuleRtask) processOneTask(session comm.IUserSession, record *pb.DB
|
|||||||
if len(params) == 1 {
|
if len(params) == 1 {
|
||||||
ok = true
|
ok = true
|
||||||
} else {
|
} 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 {
|
if !ok {
|
||||||
|
@ -2,20 +2,20 @@
|
|||||||
package rtask
|
package rtask
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
"go_dreamfactory/utils"
|
"go_dreamfactory/utils"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
)
|
)
|
||||||
|
|
||||||
// n params (1-GreatEqual 2-equal 3-equal 4-equal 5-equal)
|
// 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) {
|
func (this *ModelRtaskRecord) verifyMultiEqual(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
|
||||||
if len(params) == 0 {
|
if len(params) == 0 {
|
||||||
err = errors.New("玩家参数数据缺失")
|
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var paramLen int
|
var paramLen int
|
||||||
@ -89,17 +89,18 @@ func (this *ModelRtaskRecord) verifyFirstEqualParam(uid string, cfg *cfg.GameRdt
|
|||||||
|
|
||||||
// firstParam (first-greatEqual)
|
// firstParam (first-greatEqual)
|
||||||
func (this *ModelRtaskRecord) verifyFirstGreatEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
|
func (this *ModelRtaskRecord) verifyFirstGreatEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
|
||||||
if len(params) == 1 {
|
if len(params) != 1 {
|
||||||
ok = true
|
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
|
||||||
// ok, err = soGreatEqual(params[0], cfg.Data1)
|
return
|
||||||
}
|
}
|
||||||
|
ok = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// three params (first-greatEqual second-equal third-lessEqual)
|
// 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) {
|
func (this *ModelRtaskRecord) verifyThirdLessEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
|
||||||
if len(params) != 3 {
|
if len(params) != 3 {
|
||||||
err = errors.New("玩家参数数据缺失")
|
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var paramLen int
|
var paramLen int
|
||||||
@ -128,7 +129,7 @@ func (this *ModelRtaskRecord) verifyThirdLessEqualParam(uid string, cfg *cfg.Gam
|
|||||||
// three params (first-greatEqual second-equal third-greatEqual)
|
// 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) {
|
func (this *ModelRtaskRecord) verifyThirdGreatEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
|
||||||
if len(params) != 3 {
|
if len(params) != 3 {
|
||||||
err = errors.New("玩家参数数据缺失")
|
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var paramLen int
|
var paramLen int
|
||||||
@ -157,20 +158,11 @@ func (this *ModelRtaskRecord) verifyThirdGreatEqualParam(uid string, cfg *cfg.Ga
|
|||||||
// two params (first-Equal second-Equal)
|
// two params (first-Equal second-Equal)
|
||||||
func (this *ModelRtaskRecord) veriftyEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
|
func (this *ModelRtaskRecord) veriftyEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
|
||||||
if len(params) != 2 {
|
if len(params) != 2 {
|
||||||
err = errors.New("玩家参数数据缺失")
|
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// var paramLen int
|
// var paramLen int
|
||||||
if _, err = lenParam(cfg, params...); err == nil {
|
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 {
|
if ok, err = soEqual(params[1], cfg.Data2); !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -182,7 +174,7 @@ func (this *ModelRtaskRecord) veriftyEqualParam(uid string, cfg *cfg.GameRdtaskC
|
|||||||
// two params (first-Equal second-GreatEqual)
|
// two params (first-Equal second-GreatEqual)
|
||||||
func (this *ModelRtaskRecord) veriftyGreatEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
|
func (this *ModelRtaskRecord) veriftyGreatEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
|
||||||
if len(params) != 2 {
|
if len(params) != 2 {
|
||||||
err = errors.New("玩家参数数据缺失")
|
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// var paramLen int
|
// var paramLen int
|
||||||
|
@ -192,7 +192,7 @@ func (this *Worldtask) BingoJumpTask(session comm.IUserSession, groupId, taskId
|
|||||||
//遍历
|
//遍历
|
||||||
if taskConf.Ontxe != 0 && taskConf.IdAfter != 0 {
|
if taskConf.Ontxe != 0 && taskConf.IdAfter != 0 {
|
||||||
for _, v := range this.worldtaskConf.GetDataList() {
|
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)
|
mytask.TaskList = append(mytask.TaskList, v.Key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ func (this *Worldtask) BingoJumpTask(session comm.IUserSession, groupId, taskId
|
|||||||
"taskList": mytask.TaskList,
|
"taskList": mytask.TaskList,
|
||||||
}
|
}
|
||||||
|
|
||||||
//当前任务
|
//下个任务
|
||||||
nextTaskIds := this.modelWorldtask.findNextTasks(taskId)
|
nextTaskIds := this.modelWorldtask.findNextTasks(taskId)
|
||||||
|
|
||||||
if mytask.CurrentTask == nil {
|
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)
|
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
|
// 返回任务ID
|
||||||
func (this *Worldtask) GetWorldTaskBy(session comm.IUserSession, groupId int32) (taskId int32) {
|
func (this *Worldtask) GetWorldTaskBy(session comm.IUserSession, groupId int32) (taskId int32) {
|
||||||
uid := session.GetUserId()
|
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