diff --git a/cmd/v2/resources/config.yaml b/cmd/v2/resources/config.yaml index 7003e83e5..1e477ef6d 100644 --- a/cmd/v2/resources/config.yaml +++ b/cmd/v2/resources/config.yaml @@ -15,4 +15,12 @@ services: - service: sid: "dfmxf" name: 梅雄风 - url: ws://10.0.0.85:7891/gateway \ No newline at end of file + url: ws://10.0.0.85:7891/gateway + - service: + sid: "dflw" + name: 李伟 + url: ws://10.0.0.85:7891/gateway + - service: + sid: "0" + name: 广告位 + url: \ No newline at end of file diff --git a/cmd/v2/ui/mainwindow.go b/cmd/v2/ui/mainwindow.go index 64e86e593..5e6334060 100644 --- a/cmd/v2/ui/mainwindow.go +++ b/cmd/v2/ui/mainwindow.go @@ -90,15 +90,11 @@ func (ui *MainWindowImpl) createWindowContainer() { }), widget.NewToolbarAction(theme.DocumentIcon(), func() { openApp2(common.TOOLBAR_TESTER) - }), - widget.NewToolbarSeparator(), + }), + widget.NewToolbarSpacer(), widget.NewToolbarAction(theme.FileIcon(), func() { newLogViewer().Win.Show() }), - widget.NewToolbarSpacer(), - widget.NewToolbarAction(theme.HelpIcon(), func() { - showAbout() - }), ) ui.tb = newToolBar(toolbar) diff --git a/cmd/v2/ui/views/rtask_testview.go b/cmd/v2/ui/views/rtask_testview.go index ac51de767..b1df49ed6 100644 --- a/cmd/v2/ui/views/rtask_testview.go +++ b/cmd/v2/ui/views/rtask_testview.go @@ -23,7 +23,7 @@ func (this *RtaskTestView) CreateView(t *model.TestCase) fyne.CanvasObject { paramsInput.PlaceHolder = "多个数值使用,分隔" condiInput := widget.NewEntry() - condiInput.PlaceHolder = "条件配置ID" + condiInput.PlaceHolder = "条件ID为空时走触发逻辑否则走校验逻辑" this.form.AppendItem(widget.NewFormItem("任务类型", rtaskTypeInput)) this.form.AppendItem(widget.NewFormItem("参数", paramsInput)) diff --git a/modules/friend/api_randlist.go b/modules/friend/api_randlist.go index 79217b67d..00e92eeed 100644 --- a/modules/friend/api_randlist.go +++ b/modules/friend/api_randlist.go @@ -17,7 +17,7 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR self *pb.DBFriend ) //在线玩家 - cu, err := this.moduleFriend.ModuleUser.UserOnlineList() + cuList, err := this.moduleFriend.ModuleUser.UserOnlineList() if err != nil { code = pb.ErrorCode_DBError return @@ -25,13 +25,17 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR // 只随机选择5个在线玩家 var randOnlineUsers []string - if len(cu) > 5 { - randArr := utils.Numbers(0, len(cu), 5) + if len(cuList) > 5 { + randArr := utils.Numbers(0, len(cuList), 5) for _, v := range randArr { - if cu[v] != nil { - randOnlineUsers = append(randOnlineUsers, cu[v].Uid) + if cuList[v] != nil { + randOnlineUsers = append(randOnlineUsers, cuList[v].Uid) } } + } else { + for _, v := range cuList { + randOnlineUsers = append(randOnlineUsers, v.Uid) + } } // 当前玩家好友数据 diff --git a/modules/hero/api_drawCard.go b/modules/hero/api_drawCard.go index cb990abc9..4ca6e4a05 100644 --- a/modules/hero/api_drawCard.go +++ b/modules/hero/api_drawCard.go @@ -198,8 +198,8 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq for _, star := range szStar { sz[star]++ } - for k, v := range sz { - this.module.ModuleRtask.SendToRtask(session, comm.Rtype17, k, v) + for k, _ := range sz { + this.module.ModuleRtask.SendToRtask(session, comm.Rtype17, 1, k) } } this.module.ModuleRtask.SendToRtask(session, comm.Rtype14, req.DrawCount) diff --git a/modules/rtask/condiFindHandle.go b/modules/rtask/condiFindHandle.go index 1d7c290fa..02db5f983 100644 --- a/modules/rtask/condiFindHandle.go +++ b/modules/rtask/condiFindHandle.go @@ -60,21 +60,21 @@ func (this *ModelRtaskRecord) greatThanParams(cfg *cfg.GameRdtaskCondiData, vals return } case 2: - if !(soGreatThan(vals[0], cfg.Data1) && soGreatThan(vals[1], cfg.Data2)) { + if !(soGreatThan(vals[0], cfg.Data1) && soEqual(vals[1], cfg.Data2)) { return } case 3: - if !(soGreatThan(vals[0], cfg.Data1) && soGreatThan(vals[1], cfg.Data2) && soGreatThan(vals[2], cfg.Data3)) { + if !(soGreatThan(vals[0], cfg.Data1) && soEqual(vals[1], cfg.Data2) && soEqual(vals[2], cfg.Data3)) { return } case 4: - if !(soGreatThan(vals[0], cfg.Data1) && soGreatThan(vals[1], cfg.Data2) && - soGreatThan(vals[2], cfg.Data3) && soGreatThan(vals[3], cfg.Data4)) { + if !(soGreatThan(vals[0], cfg.Data1) && soEqual(vals[1], cfg.Data2) && + soEqual(vals[2], cfg.Data3) && soEqual(vals[3], cfg.Data4)) { return } case 5: - if !(soGreatThan(vals[0], cfg.Data1) && soGreatThan(vals[1], cfg.Data2) && - soGreatThan(vals[2], cfg.Data3) && soGreatThan(vals[3], cfg.Data4) && soGreatThan(vals[4], cfg.Data5)) { + if !(soGreatThan(vals[0], cfg.Data1) && soEqual(vals[1], cfg.Data2) && + soEqual(vals[2], cfg.Data3) && soEqual(vals[3], cfg.Data4) && soEqual(vals[4], cfg.Data5)) { return } default: @@ -101,21 +101,21 @@ func (this *ModelRtaskRecord) lessThanParams(cfg *cfg.GameRdtaskCondiData, vals return } case 2: - if !(soLessThan(vals[0], cfg.Data1) && soLessThan(vals[1], cfg.Data2)) { + if !(soLessThan(vals[0], cfg.Data1) && soEqual(vals[1], cfg.Data2)) { return } case 3: - if !(soLessThan(vals[0], cfg.Data1) && soLessThan(vals[1], cfg.Data2) && soLessThan(vals[2], cfg.Data3)) { + if !(soLessThan(vals[0], cfg.Data1) && soEqual(vals[1], cfg.Data2) && soEqual(vals[2], cfg.Data3)) { return } case 4: - if !(soLessThan(vals[0], cfg.Data1) && soLessThan(vals[1], cfg.Data2) && - soLessThan(vals[2], cfg.Data3) && soLessThan(vals[3], cfg.Data4)) { + if !(soLessThan(vals[0], cfg.Data1) && soEqual(vals[1], cfg.Data2) && + soEqual(vals[2], cfg.Data3) && soEqual(vals[3], cfg.Data4)) { return } case 5: - if !(soLessThan(vals[0], cfg.Data1) && soLessThan(vals[1], cfg.Data2) && - soLessThan(vals[2], cfg.Data3) && soLessThan(vals[3], cfg.Data4) && soLessThan(vals[4], cfg.Data5)) { + if !(soLessThan(vals[0], cfg.Data1) && soEqual(vals[1], cfg.Data2) && + soEqual(vals[2], cfg.Data3) && soEqual(vals[3], cfg.Data4) && soEqual(vals[4], cfg.Data5)) { return } default: diff --git a/modules/rtask/help.go b/modules/rtask/help.go index 19c434b0e..994b7af61 100644 --- a/modules/rtask/help.go +++ b/modules/rtask/help.go @@ -16,6 +16,7 @@ func verifyParam(cfg *cfg.GameRdtaskCondiData, vals ...int32) (n int, err error) return } else { n = len(vals) + return } } @@ -25,6 +26,7 @@ func verifyParam(cfg *cfg.GameRdtaskCondiData, vals ...int32) (n int, err error) return } else { n = len(vals) + return } } @@ -34,6 +36,7 @@ func verifyParam(cfg *cfg.GameRdtaskCondiData, vals ...int32) (n int, err error) return } else { n = len(vals) + return } } @@ -43,6 +46,7 @@ func verifyParam(cfg *cfg.GameRdtaskCondiData, vals ...int32) (n int, err error) return } else { n = len(vals) + return } } @@ -52,6 +56,7 @@ func verifyParam(cfg *cfg.GameRdtaskCondiData, vals ...int32) (n int, err error) return } else { n = len(vals) + return } } diff --git a/modules/rtask/module.go b/modules/rtask/module.go index a47cae783..c9477d102 100644 --- a/modules/rtask/module.go +++ b/modules/rtask/module.go @@ -132,42 +132,14 @@ func (this *ModuleRtask) initRtaskVerifyHandle() { verify: this.modelRtaskRecord.verifyFromDb, update: this.modelRtaskRecord.overrideUpdate, }) - case comm.Rtype12: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.greatThanParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype13: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.lessThanParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype14: + case comm.Rtype12, comm.Rtype13, comm.Rtype14, comm.Rtype15: this.registerVerifyHandle(v.Id, &rtaskCondi{ cfg: typeCfg, find: this.modelRtaskRecord.lessThanParams, verify: this.modelRtaskRecord.verifyFromDb, update: this.modelRtaskRecord.addUpdate, }) - case comm.Rtype15: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.lessThanParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.addUpdate, - }) - case comm.Rtype16: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype17: + case comm.Rtype16, comm.Rtype17, comm.Rtype19: this.registerVerifyHandle(v.Id, &rtaskCondi{ cfg: typeCfg, find: this.modelRtaskRecord.equalParams, @@ -181,13 +153,6 @@ func (this *ModuleRtask) initRtaskVerifyHandle() { verify: this.modelRtaskRecord.verifyFromDb, update: this.modelRtaskRecord.overrideUpdate, }) - case comm.Rtype19: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) case comm.Rtype20: this.registerVerifyHandle(v.Id, &rtaskCondi{ cfg: typeCfg, @@ -210,86 +175,25 @@ func (this *ModuleRtask) initRtaskVerifyHandle() { case comm.Rtype23: this.registerVerifyHandle(v.Id, &rtaskCondi{ cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, + find: this.modelRtaskRecord.lessThanParams, verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, + update: this.modelRtaskRecord.addUpdate, }) - case comm.Rtype24: + case comm.Rtype24, comm.Rtype25, comm.Rtype26, comm.Rtype27, + comm.Rtype28, comm.Rtype29, comm.Rtype30, comm.Rtype31, + comm.Rtype32, comm.Rtype33, comm.Rtype34, comm.Rtype36, + comm.Rtype37, comm.Rtype38, comm.Rtype39, comm.Rtype41, + comm.Rtype42, comm.Rtype43, comm.Rtype45, + comm.Rtype46, comm.Rtype47, comm.Rtype48, comm.Rtype49, + comm.Rtype50, comm.Rtype51, comm.Rtype52, comm.Rtype53, + comm.Rtype54, comm.Rtype55, comm.Rtype56, comm.Rtype57, + comm.Rtype58, comm.Rtype60, comm.Rtype62, comm.Rtype64, + comm.Rtype65, comm.Rtype66, comm.Rtype67, comm.Rtype69: this.registerVerifyHandle(v.Id, &rtaskCondi{ cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, + find: this.modelRtaskRecord.lessThanParams, verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype25: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype26: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype27: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype28: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype29: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype30: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype31: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype32: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype33: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype34: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, + update: this.modelRtaskRecord.addUpdate, }) case comm.Rtype35: this.registerVerifyHandle(v.Id, &rtaskCondi{ @@ -298,34 +202,6 @@ func (this *ModuleRtask) initRtaskVerifyHandle() { verify: this.modelRtaskRecord.verifyFromDb, update: this.modelRtaskRecord.overrideUpdate, }) - case comm.Rtype36: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype37: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype38: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype39: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) case comm.Rtype40: this.registerVerifyHandle(v.Id, &rtaskCondi{ cfg: typeCfg, @@ -333,140 +209,7 @@ func (this *ModuleRtask) initRtaskVerifyHandle() { verify: this.modelRtaskRecord.verifyFromDb, update: this.modelRtaskRecord.overrideUpdate, }) - case comm.Rtype41: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype42: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype43: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype44: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype45: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype46: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype47: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype48: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype49: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype50: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype51: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype52: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype53: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype54: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype55: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype56: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype57: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype58: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype59: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype60: + case comm.Rtype44, comm.Rtype59: this.registerVerifyHandle(v.Id, &rtaskCondi{ cfg: typeCfg, find: this.modelRtaskRecord.equalParams, @@ -480,46 +223,11 @@ func (this *ModuleRtask) initRtaskVerifyHandle() { verify: this.modelRtaskRecord.verifyFromDb, update: this.modelRtaskRecord.overrideUpdate, }) - case comm.Rtype62: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) case comm.Rtype63: this.registerVerifyHandle(v.Id, &rtaskCondi{ cfg: typeCfg, verify: this.modelRtask.verifyRtype63, }) - case comm.Rtype64: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype65: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype66: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) - case comm.Rtype67: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) case comm.Rtype68: this.registerVerifyHandle(v.Id, &rtaskCondi{ cfg: typeCfg, @@ -527,13 +235,6 @@ func (this *ModuleRtask) initRtaskVerifyHandle() { verify: this.modelRtaskRecord.verifyFromDb, update: this.modelRtaskRecord.overrideUpdate, }) - case comm.Rtype69: - this.registerVerifyHandle(v.Id, &rtaskCondi{ - cfg: typeCfg, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, - update: this.modelRtaskRecord.overrideUpdate, - }) case comm.Rtype70: this.registerVerifyHandle(v.Id, &rtaskCondi{ cfg: typeCfg, @@ -550,6 +251,7 @@ func (this *ModuleRtask) initRtaskVerifyHandle() { } func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.TaskType, params ...int32) (code pb.ErrorCode) { + log.Debugf("Rtask params: %v", params) var ( condiId int32 condi *rtaskCondi @@ -572,7 +274,7 @@ func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.T if condiId == 0 { log.Debugf("condi not found, typeId: %v params: %v", rtaskType, params) - code = pb.ErrorCode_ConfigNoFound + code = pb.ErrorCode_RtaskCondiNoFound return } diff --git a/modules/rtask/updateHandle.go b/modules/rtask/updateHandle.go index e1e363854..8018c9052 100644 --- a/modules/rtask/updateHandle.go +++ b/modules/rtask/updateHandle.go @@ -71,11 +71,6 @@ func (this *ModelRtaskRecord) overrideUpdate(uid string, cfg *cfg.GameRdtaskCond // 累计更新 - 招募等 func (this *ModelRtaskRecord) addUpdate(uid string, cfg *cfg.GameRdtaskCondiData, vals ...int32) (err error) { - var paramLen int - if paramLen, err = verifyParam(cfg, vals...); err != nil { - return err - } - record := &pb.DBRtaskRecord{} err = this.Get(uid, record) if err != nil { @@ -96,14 +91,13 @@ func (this *ModelRtaskRecord) addUpdate(uid string, cfg *cfg.GameRdtaskCondiData return errors.Wrapf(err, "添加玩家任务记录 err: %v rtype[%v]", uid, cfg.Id) } } else { - //查找任务数据 if v, ok := record.Vals[cfg.Id]; ok { - // 只有第一个参数为累加数值 - if paramLen == 1 { - v.Data[0] += vals[0] - v.Timestamp = time.Now().Unix() - } + count := v.Data[0] + count += vals[0] + vals[0] = count + v.Data = toMap(vals...) + v.Timestamp = time.Now().Unix() update := map[string]interface{}{ "vals": record.Vals, @@ -111,11 +105,8 @@ func (this *ModelRtaskRecord) addUpdate(uid string, cfg *cfg.GameRdtaskCondiData err = this.Change(uid, update) } else { - data := map[int32]int32{ - 0: vals[0], - } record.Vals[cfg.Id] = &pb.RtaskData{ - Data: data, + Data: toMap(vals...), Rtype: cfg.Type, Timestamp: time.Now().Unix(), } diff --git a/modules/rtask/verifyHandle.go b/modules/rtask/verifyHandle.go index ba68fa6f9..683b3ebf3 100644 --- a/modules/rtask/verifyHandle.go +++ b/modules/rtask/verifyHandle.go @@ -11,7 +11,6 @@ import ( "github.com/spf13/cast" ) -// Deprecated func (this *ModelRtaskRecord) verifyFromDb(uid string, cfg *cfg.GameRdtaskCondiData) (err error, ok bool) { var rd *pb.RtaskData if rd, err = this.GetVerifyData(uid, cfg.Id); rd != nil { @@ -23,11 +22,16 @@ func (this *ModelRtaskRecord) verifyFromDb(uid string, cfg *cfg.GameRdtaskCondiD if paramLen, err = verifyParam(cfg, toArr(rd.Data)...); err == nil { switch paramLen { case 1: - return nil, rd.Data[0] == cfg.Data1 + return nil, soEqual(rd.Data[0], cfg.Data1) case 2: - return nil, rd.Data[0] == cfg.Data1 && rd.Data[1] == cfg.Data2 + return nil, soEqual(rd.Data[0], cfg.Data1) && soEqual(rd.Data[1], cfg.Data2) case 3: - return nil, rd.Data[0] == cfg.Data1 && rd.Data[1] == cfg.Data2 && rd.Data[2] == cfg.Data3 + return nil, soEqual(rd.Data[0], cfg.Data1) && soEqual(rd.Data[1], cfg.Data2) && soEqual(rd.Data[2], cfg.Data3) + case 4: + return nil, soEqual(rd.Data[0], cfg.Data1) && soEqual(rd.Data[1], cfg.Data2) && soEqual(rd.Data[2], cfg.Data3) && soEqual(rd.Data[3], cfg.Data4) + case 5: + return nil, soEqual(rd.Data[0], cfg.Data1) && soEqual(rd.Data[1], cfg.Data2) && soEqual(rd.Data[2], cfg.Data3) && + soEqual(rd.Data[3], cfg.Data4) && soEqual(rd.Data[4], cfg.Data5) } } } diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index ece6a62b8..c62073363 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -162,6 +162,7 @@ const ( ErrorCode_RtaskPreNoFinish ErrorCode = 2205 //前置未完成 ErrorCode_RtaskCondiNoReach ErrorCode = 2206 //未达到限定条件 ErrorCode_RtaskNoLastOne ErrorCode = 2207 //不是最后一个任务 + ErrorCode_RtaskCondiNoFound ErrorCode = 2208 //未找到符合的条件配置 // viking ErrorCode_VikingLvErr ErrorCode = 2301 // 关卡难度不匹配 ErrorCode_VikingBoosType ErrorCode = 2302 // BOSS 类型不对 @@ -314,6 +315,7 @@ var ( 2205: "RtaskPreNoFinish", 2206: "RtaskCondiNoReach", 2207: "RtaskNoLastOne", + 2208: "RtaskCondiNoFound", 2301: "VikingLvErr", 2302: "VikingBoosType", 2303: "VikingBuyMaxCount", @@ -460,6 +462,7 @@ var ( "RtaskPreNoFinish": 2205, "RtaskCondiNoReach": 2206, "RtaskNoLastOne": 2207, + "RtaskCondiNoFound": 2208, "VikingLvErr": 2301, "VikingBoosType": 2302, "VikingBuyMaxCount": 2303, @@ -512,7 +515,7 @@ var File_errorcode_proto protoreflect.FileDescriptor var file_errorcode_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2a, 0xf8, 0x18, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0x90, 0x19, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12, 0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, @@ -682,37 +685,39 @@ var file_errorcode_proto_rawDesc = []byte{ 0x68, 0x10, 0x9d, 0x11, 0x12, 0x16, 0x0a, 0x11, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x4e, 0x6f, 0x52, 0x65, 0x61, 0x63, 0x68, 0x10, 0x9e, 0x11, 0x12, 0x13, 0x0a, 0x0e, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x4c, 0x61, 0x73, 0x74, 0x4f, 0x6e, 0x65, 0x10, 0x9f, - 0x11, 0x12, 0x10, 0x0a, 0x0b, 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x4c, 0x76, 0x45, 0x72, 0x72, - 0x10, 0xfd, 0x11, 0x12, 0x13, 0x0a, 0x0e, 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x42, 0x6f, 0x6f, - 0x73, 0x54, 0x79, 0x70, 0x65, 0x10, 0xfe, 0x11, 0x12, 0x16, 0x0a, 0x11, 0x56, 0x69, 0x6b, 0x69, - 0x6e, 0x67, 0x42, 0x75, 0x79, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xff, 0x11, - 0x12, 0x1c, 0x0a, 0x17, 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x78, 0x43, 0x68, 0x61, - 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0x80, 0x12, 0x12, 0x1a, - 0x0a, 0x15, 0x4d, 0x6f, 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61, 0x73, 0x79, 0x48, 0x61, 0x73, - 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x10, 0xe1, 0x12, 0x12, 0x16, 0x0a, 0x11, 0x4d, 0x6f, - 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61, 0x73, 0x79, 0x4a, 0x6f, 0x69, 0x6e, 0x55, 0x70, 0x10, - 0xe2, 0x12, 0x12, 0x16, 0x0a, 0x11, 0x4d, 0x6f, 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61, 0x73, - 0x79, 0x44, 0x61, 0x72, 0x65, 0x55, 0x70, 0x10, 0xe3, 0x12, 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x6f, - 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61, 0x73, 0x79, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x4e, - 0x6f, 0x45, 0x6e, 0x64, 0x10, 0xe4, 0x12, 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x6f, 0x6f, 0x6e, 0x66, - 0x61, 0x6e, 0x74, 0x61, 0x73, 0x79, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x4e, 0x6f, 0x57, 0x69, - 0x6e, 0x10, 0xe5, 0x12, 0x12, 0x18, 0x0a, 0x13, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x4e, 0x6f, - 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x10, 0xc5, 0x13, 0x12, 0x1a, - 0x0a, 0x15, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x73, 0x6b, 0x46, - 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xa9, 0x14, 0x12, 0x1d, 0x0a, 0x18, 0x4c, 0x69, - 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x75, 0x62, 0x54, 0x61, 0x73, 0x6b, 0x46, 0x69, - 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xaa, 0x14, 0x12, 0x1f, 0x0a, 0x1a, 0x4c, 0x69, 0x6e, - 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x73, 0x6b, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, - 0x65, 0x64, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x10, 0xab, 0x14, 0x12, 0x1f, 0x0a, 0x1a, 0x4c, 0x69, - 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, - 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xac, 0x14, 0x12, 0x11, 0x0a, 0x0c, 0x48, - 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x4c, 0x76, 0x45, 0x72, 0x72, 0x10, 0x8d, 0x15, 0x12, 0x14, - 0x0a, 0x0f, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x6f, 0x6f, 0x73, 0x54, 0x79, 0x70, - 0x65, 0x10, 0x8e, 0x15, 0x12, 0x17, 0x0a, 0x12, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x42, - 0x75, 0x79, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0x8f, 0x15, 0x12, 0x1d, 0x0a, - 0x18, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x78, 0x43, 0x68, 0x61, 0x6c, 0x6c, - 0x65, 0x6e, 0x67, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0x90, 0x15, 0x42, 0x06, 0x5a, 0x04, - 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x11, 0x12, 0x16, 0x0a, 0x11, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x4e, + 0x6f, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xa0, 0x11, 0x12, 0x10, 0x0a, 0x0b, 0x56, 0x69, 0x6b, + 0x69, 0x6e, 0x67, 0x4c, 0x76, 0x45, 0x72, 0x72, 0x10, 0xfd, 0x11, 0x12, 0x13, 0x0a, 0x0e, 0x56, + 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x42, 0x6f, 0x6f, 0x73, 0x54, 0x79, 0x70, 0x65, 0x10, 0xfe, 0x11, + 0x12, 0x16, 0x0a, 0x11, 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x79, 0x4d, 0x61, 0x78, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xff, 0x11, 0x12, 0x1c, 0x0a, 0x17, 0x56, 0x69, 0x6b, 0x69, + 0x6e, 0x67, 0x4d, 0x61, 0x78, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x10, 0x80, 0x12, 0x12, 0x1a, 0x0a, 0x15, 0x4d, 0x6f, 0x6f, 0x6e, 0x66, 0x61, + 0x6e, 0x74, 0x61, 0x73, 0x79, 0x48, 0x61, 0x73, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x10, + 0xe1, 0x12, 0x12, 0x16, 0x0a, 0x11, 0x4d, 0x6f, 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61, 0x73, + 0x79, 0x4a, 0x6f, 0x69, 0x6e, 0x55, 0x70, 0x10, 0xe2, 0x12, 0x12, 0x16, 0x0a, 0x11, 0x4d, 0x6f, + 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61, 0x73, 0x79, 0x44, 0x61, 0x72, 0x65, 0x55, 0x70, 0x10, + 0xe3, 0x12, 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x6f, 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61, 0x73, + 0x79, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x4e, 0x6f, 0x45, 0x6e, 0x64, 0x10, 0xe4, 0x12, 0x12, + 0x1b, 0x0a, 0x16, 0x4d, 0x6f, 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61, 0x73, 0x79, 0x42, 0x61, + 0x74, 0x74, 0x6c, 0x65, 0x4e, 0x6f, 0x57, 0x69, 0x6e, 0x10, 0xe5, 0x12, 0x12, 0x18, 0x0a, 0x13, + 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x4e, 0x6f, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x10, 0xc5, 0x13, 0x12, 0x1a, 0x0a, 0x15, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, + 0x6f, 0x72, 0x79, 0x54, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, + 0xa9, 0x14, 0x12, 0x1d, 0x0a, 0x18, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x53, + 0x75, 0x62, 0x54, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xaa, + 0x14, 0x12, 0x1f, 0x0a, 0x1a, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, + 0x73, 0x6b, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x10, + 0xab, 0x14, 0x12, 0x1f, 0x0a, 0x1a, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x50, + 0x72, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, + 0x10, 0xac, 0x14, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x4c, 0x76, + 0x45, 0x72, 0x72, 0x10, 0x8d, 0x15, 0x12, 0x14, 0x0a, 0x0f, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, + 0x67, 0x42, 0x6f, 0x6f, 0x73, 0x54, 0x79, 0x70, 0x65, 0x10, 0x8e, 0x15, 0x12, 0x17, 0x0a, 0x12, + 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x79, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x10, 0x8f, 0x15, 0x12, 0x1d, 0x0a, 0x18, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, + 0x4d, 0x61, 0x78, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x10, 0x90, 0x15, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var (