From 7dcb823d1d1132878c6283b9740e9fa6dc2f95db Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Thu, 5 Jan 2023 19:46:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?ping=E7=AB=AF=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/v2/ui/perf_choose.go | 82 ++++++++++++++++++++-------------------- cmd/v2/ui/perf_pb.go | 26 ++++++------- cmd/v2/ui/tool_ping.go | 32 ++++++++++++++-- cmd/v2/ui/toolwindow.go | 2 +- 4 files changed, 81 insertions(+), 61 deletions(-) diff --git a/cmd/v2/ui/perf_choose.go b/cmd/v2/ui/perf_choose.go index 3cc27597f..2d4825ee9 100644 --- a/cmd/v2/ui/perf_choose.go +++ b/cmd/v2/ui/perf_choose.go @@ -8,8 +8,6 @@ import ( "go_dreamfactory/cmd/v2/service/observer" "go_dreamfactory/comm" "go_dreamfactory/pb" - cfg "go_dreamfactory/sys/configure/structs" - "strings" "time" "fyne.io/fyne/v2" @@ -133,49 +131,49 @@ func (app *perfChoose) LazyInit(ptService service.PttService, obs observer.Obser closeApp3(perfWin.tabs, common.TOOLBAR_PERF_CHOOSE) openApp3(perfWin.tabs, common.TOOLBAR_PERF_RES) - if tables, err := cfg.NewTables(common.Loader); err != nil { - println(err.Error()) - } else { - for _, v := range tables.TestFlow.GetDataList() { - p, ok := pbMap[v.Route] - if !ok { - logrus.WithField("route", v.Route).Debug("未注册") - continue - } - routeStr := strings.SplitN(v.Route, ".", 2) - for _, account := range app.binduids { - rq := ReqParams{ - Sid: app.conf.SId, - Account: account, - PbReq: p, - MainType: routeStr[0], - SubType: routeStr[1], - } - b, err := app.buildReq(rq) - if err != nil { - logrus.Error(err) - return - } - app.handler.SetReq(b, true) - } + // if tables, err := cfg.NewTables(common.Loader); err != nil { + // println(err.Error()) + // } else { + // for _, v := range tables.TestFlow.GetDataList() { + // p, ok := pbMap[v.Route] + // if !ok { + // logrus.WithField("route", v.Route).Debug("未注册") + // continue + // } + // routeStr := strings.SplitN(v.Route, ".", 2) + // for _, account := range app.binduids { + // rq := ReqParams{ + // Sid: app.conf.SId, + // Account: account, + // PbReq: p, + // MainType: routeStr[0], + // SubType: routeStr[1], + // } + // b, err := app.buildReq(rq) + // if err != nil { + // logrus.Error(err) + // return + // } + // app.handler.SetReq(b, true) + // } - param := lib.ParamMgr{ - Caller: app.handler, - Timeout: time.Duration(app.conf.Pressure.TimeoutMs) * time.Millisecond, - Lps: uint32(app.conf.Pressure.Concurrency), - Duration: time.Duration(app.conf.Pressure.DurationS) * time.Second, - ResultCh: make(chan *lib.CallResult, 50), - } - a, err := lib.NewAssistant(obs, param) - if err != nil { - logrus.Error(err) - } + // param := lib.ParamMgr{ + // Caller: app.handler, + // Timeout: time.Duration(app.conf.Pressure.TimeoutMs) * time.Millisecond, + // Lps: uint32(app.conf.Pressure.Concurrency), + // Duration: time.Duration(app.conf.Pressure.DurationS) * time.Second, + // ResultCh: make(chan *lib.CallResult, 50), + // } + // a, err := lib.NewAssistant(obs, param) + // if err != nil { + // logrus.Error(err) + // } - a.Start() + // a.Start() - a.ShowResult() - } - } + // a.ShowResult() + // } + // } } //上一步 diff --git a/cmd/v2/ui/perf_pb.go b/cmd/v2/ui/perf_pb.go index 1a317b902..49ea09ff2 100644 --- a/cmd/v2/ui/perf_pb.go +++ b/cmd/v2/ui/perf_pb.go @@ -1,7 +1,6 @@ package ui import ( - "fmt" "go_dreamfactory/cmd/v2/lib" "go_dreamfactory/cmd/v2/lib/common" "go_dreamfactory/cmd/v2/lib/storage" @@ -20,7 +19,6 @@ import ( "fyne.io/fyne/v2/widget" "github.com/Pallinder/go-randomdata" "github.com/sirupsen/logrus" - "github.com/spf13/cast" "google.golang.org/protobuf/proto" ) @@ -47,18 +45,18 @@ func (app *perfPb) LazyInit(ptService service.PttService, obs observer.Observer) app.itemList.ItemList = app.itemList.CreateList() app.pbList = func() { - if tables, err := cfg.NewTables(common.Loader); err != nil { - println(err.Error()) - } else { - for _, v := range tables.TestFlow.GetDataList() { - item := common.Item{ - Id: cast.ToString(v.Id), - Text: fmt.Sprintf("%-6d %-20s %-20s %s", v.Id, v.Msg, v.Route, v.Params), - Data: v, - } - app.itemList.AddItem(item) - } - } + // if tables, err := cfg.NewTables(common.Loader); err != nil { + // println(err.Error()) + // } else { + // for _, v := range tables.TestFlow.GetDataList() { + // item := common.Item{ + // Id: cast.ToString(v.Id), + // Text: fmt.Sprintf("%-6d %-20s %-20s %s", v.Id, v.Msg, v.Route, v.Params), + // Data: v, + // } + // app.itemList.AddItem(item) + // } + // } } defer app.pbList() diff --git a/cmd/v2/ui/tool_ping.go b/cmd/v2/ui/tool_ping.go index d863e67f0..2f8c5b9a0 100644 --- a/cmd/v2/ui/tool_ping.go +++ b/cmd/v2/ui/tool_ping.go @@ -14,6 +14,7 @@ import ( "fyne.io/fyne/v2/container" "fyne.io/fyne/v2/theme" "fyne.io/fyne/v2/widget" + "github.com/sirupsen/logrus" "github.com/spf13/cast" ) @@ -25,8 +26,6 @@ type appPing struct { func (this *appPing) LazyInit(ptService service.PttService, obs observer.Observer) error { this.tabItem = container.NewTabItemWithIcon(common.TOOLBAR_PING, theme.DownloadIcon(), nil) - this.resultCh = make(chan int) - content := container.NewMax() content.Objects = []fyne.CanvasObject{} @@ -36,18 +35,41 @@ func (this *appPing) LazyInit(ptService service.PttService, obs observer.Observe portEntry := widget.NewMultiLineEntry() portEntry.Text = "80,3306,6379" form := widget.NewForm( + widget.NewFormItem("主机", targetHost), widget.NewFormItem("端口", portEntry), ) + // result + result := widget.NewMultiLineEntry() form.OnSubmit = func() { + result.Text = "" + if portEntry.Text == "" { + return + } + this.resultCh = make(chan int) ports := strings.Split(portEntry.Text, ",") this.ping(targetHost.Text, ports) + + var msgs []string + for p := range this.resultCh { - fmt.Println(p, "ok") + for _, v := range ports { + if cast.ToInt(v) == p { + msgs = append(msgs, fmt.Sprintf("端口:%d OK", p)) + } else { + msgs = append(msgs, fmt.Sprintf("端口:%s ERR", v)) + } + result.Text = strings.Join(msgs, "\n") + result.Refresh() + } } } form.Items[1].HintText = "多个端口使用英文,号分隔" - content.Objects = append(content.Objects, form) + + result.OnChanged = func(s string) { + result.Refresh() + } + content.Objects = append(content.Objects, container.NewBorder(form, nil, nil, nil, result)) this.tabItem.Content = content return nil } @@ -61,6 +83,8 @@ func (this *appPing) ping(targetHost string, ports []string) { _, err := net.DialTimeout("tcp", fmt.Sprintf("%s:%d", targetHost, p), time.Millisecond*500) if err == nil { this.resultCh <- p + } else { + logrus.Error(err) } }(cast.ToInt(port)) } diff --git a/cmd/v2/ui/toolwindow.go b/cmd/v2/ui/toolwindow.go index 043e7b783..9abc7ab3e 100644 --- a/cmd/v2/ui/toolwindow.go +++ b/cmd/v2/ui/toolwindow.go @@ -53,7 +53,7 @@ func NewToolWindow(ui *UIImpl, parent fyne.Window) ToolWindow { openApp2(mw.at, common.TOOLBAR_TERM) }), - widget.NewToolbarAction(theme.MailSendIcon(), func() { + widget.NewToolbarAction(theme.ComputerIcon(), func() { openApp2(mw.at, common.TOOLBAR_PING) }), From 7729449f36a5f18d8e525f6d5b480f69371f8c3a Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Thu, 5 Jan 2023 19:46:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?openCond=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_opencond.json | 628 +++++++++++++++++++-- modules/sys/api_func.go | 7 +- modules/sys/model_sys.go | 8 +- modules/user/comp_configure.go | 7 +- sys/configure/structs/Game.OpenedCond.go | 37 ++ sys/configure/structs/Tables.go | 7 - sys/configure/structs/game.opencondData.go | 17 +- 7 files changed, 645 insertions(+), 66 deletions(-) create mode 100644 sys/configure/structs/Game.OpenedCond.go diff --git a/bin/json/game_opencond.json b/bin/json/game_opencond.json index ab000d284..9f0cf1750 100644 --- a/bin/json/game_opencond.json +++ b/bin/json/game_opencond.json @@ -5,7 +5,16 @@ "key": "opencond_name_10002", "text": "英雄" }, - "main": 1, + "main": [ + { + "key": "platlv", + "param": 1 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -22,7 +31,16 @@ "key": "opencond_name_10006", "text": "背包" }, - "main": 3, + "main": [ + { + "key": "platlv", + "param": 3 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 1, "kqbx": 0, @@ -39,7 +57,16 @@ "key": "opencond_name_10003", "text": "购物" }, - "main": 1, + "main": [ + { + "key": "platlv", + "param": 1 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -56,7 +83,16 @@ "key": "opencond_name_10004", "text": "好友" }, - "main": 3, + "main": [ + { + "key": "platlv", + "param": 3 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -73,7 +109,16 @@ "key": "opencond_name_10003", "text": "商城" }, - "main": 999, + "main": [ + { + "key": "platlv", + "param": 999 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 2, "kqbx": 0, @@ -90,7 +135,16 @@ "key": "opencond_name_10003", "text": "随机任务总览" }, - "main": 3, + "main": [ + { + "key": "platlv", + "param": 3 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 2, "kqbx": 0, @@ -107,7 +161,16 @@ "key": "opencond_name_10003", "text": "充值" }, - "main": 1, + "main": [ + { + "key": "platlv", + "param": 1 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -124,7 +187,16 @@ "key": "opencond_name_10007", "text": "活动" }, - "main": 1, + "main": [ + { + "key": "platlv", + "param": 1 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -141,7 +213,16 @@ "key": "opencond_name_10005", "text": "任务" }, - "main": 10, + "main": [ + { + "key": "platlv", + "param": 10 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 1, "kqbx": 0, @@ -158,7 +239,16 @@ "key": "num_1001", "text": "主线入口" }, - "main": 1, + "main": [ + { + "key": "platlv", + "param": 1 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -175,7 +265,16 @@ "key": "num_1002", "text": "招募" }, - "main": 1, + "main": [ + { + "key": "platlv", + "param": 1 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -192,7 +291,16 @@ "key": "num_1003", "text": "剧情副本" }, - "main": 999, + "main": [ + { + "key": "platlv", + "param": 999 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 2, "kqbx": 0, @@ -209,7 +317,16 @@ "key": "num_1004", "text": "武馆入口" }, - "main": 1, + "main": [ + { + "key": "platlv", + "param": 1 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -226,7 +343,16 @@ "key": "num_1005", "text": "主题活动入口" }, - "main": 999, + "main": [ + { + "key": "platlv", + "param": 999 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 2, "kqbx": 0, @@ -243,7 +369,16 @@ "key": "num_1006", "text": "迷雾岛屿" }, - "main": 999, + "main": [ + { + "key": "platlv", + "param": 999 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 2, "kqbx": 0, @@ -260,7 +395,16 @@ "key": "num_1007", "text": "装备副本" }, - "main": 3, + "main": [ + { + "key": "platlv", + "param": 3 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -277,7 +421,16 @@ "key": "num_1007", "text": "武器副本" }, - "main": 3, + "main": [ + { + "key": "platlv", + "param": 3 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -294,7 +447,16 @@ "key": "num_1007", "text": "饰品副本" }, - "main": 3, + "main": [ + { + "key": "platlv", + "param": 3 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -311,7 +473,16 @@ "key": "num_1008", "text": "心魔塔" }, - "main": 3, + "main": [ + { + "key": "platlv", + "param": 3 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -328,7 +499,16 @@ "key": "num_1009", "text": "捕羊大赛" }, - "main": 999, + "main": [ + { + "key": "platlv", + "param": 999 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 2, "kqbx": 0, @@ -345,7 +525,16 @@ "key": "num_1010", "text": "黑暗料理大赛" }, - "main": 999, + "main": [ + { + "key": "platlv", + "param": 999 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 2, "kqbx": 0, @@ -362,7 +551,16 @@ "key": "num_1011", "text": "地下角斗场" }, - "main": 999, + "main": [ + { + "key": "platlv", + "param": 999 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 2, "kqbx": 0, @@ -379,7 +577,16 @@ "key": "num_1012", "text": "疯狂竞技赛" }, - "main": 999, + "main": [ + { + "key": "platlv", + "param": 999 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 2, "kqbx": 0, @@ -396,7 +603,16 @@ "key": "num_1013", "text": "五侠擂台" }, - "main": 999, + "main": [ + { + "key": "platlv", + "param": 999 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 2, "kqbx": 0, @@ -413,7 +629,16 @@ "key": "num_1014", "text": "藏书馆" }, - "main": 999, + "main": [ + { + "key": "platlv", + "param": 999 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 2, "kqbx": 0, @@ -430,7 +655,16 @@ "key": "num_1015", "text": "篝火舞会" }, - "main": 999, + "main": [ + { + "key": "platlv", + "param": 999 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 2, "kqbx": 0, @@ -447,7 +681,16 @@ "key": "num_1016", "text": "商队" }, - "main": 999, + "main": [ + { + "key": "platlv", + "param": 999 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 2, "kqbx": 0, @@ -464,7 +707,16 @@ "key": "num_1017", "text": "美食馆" }, - "main": 1, + "main": [ + { + "key": "platlv", + "param": 1 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -481,7 +733,16 @@ "key": "num_1018", "text": "戈伯铁匠铺" }, - "main": 1, + "main": [ + { + "key": "platlv", + "param": 1 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -498,7 +759,16 @@ "key": "num_1019", "text": "狩猎" }, - "main": 999, + "main": [ + { + "key": "platlv", + "param": 999 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -515,7 +785,16 @@ "key": "num_2020", "text": "聊天" }, - "main": 1, + "main": [ + { + "key": "platlv", + "param": 1 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -532,7 +811,16 @@ "key": "num_2021", "text": "世界" }, - "main": 1, + "main": [ + { + "key": "platlv", + "param": 1 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -549,7 +837,16 @@ "key": "num_2022", "text": "公会" }, - "main": 1, + "main": [ + { + "key": "platlv", + "param": 1 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -566,7 +863,16 @@ "key": "num_2023", "text": "私聊" }, - "main": 1, + "main": [ + { + "key": "platlv", + "param": 1 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -583,7 +889,16 @@ "key": "num_2024", "text": "跨服" }, - "main": 1, + "main": [ + { + "key": "platlv", + "param": 1 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -600,7 +915,16 @@ "key": "num_2025", "text": "系统" }, - "main": 1, + "main": [ + { + "key": "platlv", + "param": 1 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -617,7 +941,16 @@ "key": "num_2026", "text": "公会" }, - "main": 3, + "main": [ + { + "key": "platlv", + "param": 3 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -634,7 +967,16 @@ "key": "num_2027", "text": "竞技场" }, - "main": 3, + "main": [ + { + "key": "platlv", + "param": 3 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -651,7 +993,16 @@ "key": "num_2028", "text": "签到" }, - "main": 999, + "main": [ + { + "key": "platlv", + "param": 999 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 2, "kqbx": 0, @@ -668,7 +1019,16 @@ "key": "num_2029", "text": "红点集成" }, - "main": 3, + "main": [ + { + "key": "platlv", + "param": 3 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 1, "kqbx": 0, @@ -685,7 +1045,16 @@ "key": "num_2030", "text": "月卡" }, - "main": 3, + "main": [ + { + "key": "platlv", + "param": 3 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 2, "kqbx": 0, @@ -702,7 +1071,16 @@ "key": "num_2031", "text": "日周月礼包" }, - "main": 3, + "main": [ + { + "key": "platlv", + "param": 3 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 2, "kqbx": 0, @@ -719,7 +1097,16 @@ "key": "num_2032", "text": "主角" }, - "main": 3, + "main": [ + { + "key": "platlv", + "param": 3 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 1, "kqbx": 0, @@ -736,7 +1123,16 @@ "key": "num_2033", "text": "月之秘境" }, - "main": 2, + "main": [ + { + "key": "platlv", + "param": 2 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 2, "kqbx": 0, @@ -753,7 +1149,16 @@ "key": "num_2034", "text": "收益统计" }, - "main": 3, + "main": [ + { + "key": "platlv", + "param": 3 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 1, "kqbx": 0, @@ -770,7 +1175,16 @@ "key": "num_2035", "text": "卡牌融合" }, - "main": 13, + "main": [ + { + "key": "platlv", + "param": 13 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 1, "kqbx": 0, @@ -787,7 +1201,16 @@ "key": "num_2036", "text": "成长之路" }, - "main": 1, + "main": [ + { + "key": "platlv", + "param": 1 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 1, "kqbx": 0, @@ -804,7 +1227,16 @@ "key": "num_2030", "text": "战斗退出" }, - "main": 5, + "main": [ + { + "key": "platlv", + "param": 5 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -821,7 +1253,16 @@ "key": "num_2030", "text": "战斗倍速" }, - "main": 4, + "main": [ + { + "key": "platlv", + "param": 4 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -838,7 +1279,16 @@ "key": "num_2030", "text": "自动战斗" }, - "main": 5, + "main": [ + { + "key": "platlv", + "param": 5 + }, + { + "key": "maxmapid", + "param": 1 + } + ], "optional": "", "wkqbx": 0, "kqbx": 0, @@ -848,5 +1298,83 @@ "text": "功能暂未开启" }, "uiid": 0 + }, + { + "id": "equip_compose", + "name": { + "key": "num_2030", + "text": "装备铸造" + }, + "main": [ + { + "key": "platlv", + "param": 5 + }, + { + "key": "maxmapid", + "param": 1 + } + ], + "optional": "", + "wkqbx": 0, + "kqbx": 0, + "img": "zc_icon_01", + "prompt": { + "key": "opencond_prompt_equip_compose", + "text": "功能暂未开启" + }, + "uiid": 0 + }, + { + "id": "equip_compose_middle", + "name": { + "key": "num_2030", + "text": "装备铸造-中级" + }, + "main": [ + { + "key": "platlv", + "param": 4 + }, + { + "key": "maxmapid", + "param": 1 + } + ], + "optional": "", + "wkqbx": 0, + "kqbx": 0, + "img": "zc_icon_01", + "prompt": { + "key": "opencond_prompt_equip_compose_middle", + "text": "功能暂未开启" + }, + "uiid": 0 + }, + { + "id": "equip_compose_high", + "name": { + "key": "num_2030", + "text": "装备铸造-高级" + }, + "main": [ + { + "key": "platlv", + "param": 5 + }, + { + "key": "maxmapid", + "param": 1 + } + ], + "optional": "", + "wkqbx": 0, + "kqbx": 0, + "img": "zc_icon_01", + "prompt": { + "key": "opencond_prompt_equip_compose_high", + "text": "功能暂未开启" + }, + "uiid": 0 } ] \ No newline at end of file diff --git a/modules/sys/api_func.go b/modules/sys/api_func.go index 23b547283..ec4a53786 100644 --- a/modules/sys/api_func.go +++ b/modules/sys/api_func.go @@ -25,8 +25,11 @@ func (this *apiComp) Funclist(session comm.IUserSession, req *pb.SysFuncListReq) confList := this.moduleSys.configure.getOpencondList() for _, v := range confList { // 返回未开启的功能列表 - if user.Lv < v.Main { - funcList = append(funcList, v.Id) + for _, conf := range v.Main { + if conf.Key == "platlv" && user.Lv < conf.Param { + funcList = append(funcList, v.Id) + continue + } } } rsp.FuncIds = funcList diff --git a/modules/sys/model_sys.go b/modules/sys/model_sys.go index 6d2e9804c..3cef80442 100644 --- a/modules/sys/model_sys.go +++ b/modules/sys/model_sys.go @@ -27,9 +27,11 @@ func (this *ModelSys) IsAccess(funName string, uid string) (code pb.ErrorCode) { if user != nil { conf := this.moduleSys.configure.getFuncCfg(funName) if conf != nil { - if user.Lv < conf.Main{ - code = pb.ErrorCode_NoOpened - return + for _, v := range conf.Main { + if v.Key == "platlv" && user.Lv < v.Param { + code = pb.ErrorCode_NoOpened + return + } } } } diff --git a/modules/user/comp_configure.go b/modules/user/comp_configure.go index 531791265..a3acca4ac 100644 --- a/modules/user/comp_configure.go +++ b/modules/user/comp_configure.go @@ -78,8 +78,11 @@ func (this *configureComp) FindFunc(lv int32) (funcIds []string) { return nil } for _, d := range data.GetDataList() { - if d.Main == lv { - funcIds = append(funcIds, d.Id) + for _, v := range d.Main { + if v.Key == "platlv" && v.Param == lv { + funcIds = append(funcIds, d.Id) + continue + } } } } diff --git a/sys/configure/structs/Game.OpenedCond.go b/sys/configure/structs/Game.OpenedCond.go new file mode 100644 index 000000000..ed98c2e01 --- /dev/null +++ b/sys/configure/structs/Game.OpenedCond.go @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +package cfg + +import "errors" + +type GameOpenedCond struct { + Key string + Param int32 +} + +const TypeId_GameOpenedCond = -2110428505 + +func (*GameOpenedCond) GetTypeId() int32 { + return -2110428505 +} + +func (_v *GameOpenedCond)Deserialize(_buf map[string]interface{}) (err error) { + { var _ok_ bool; if _v.Key, _ok_ = _buf["key"].(string); !_ok_ { err = errors.New("key error"); return } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["param"].(float64); !_ok_ { err = errors.New("param error"); return }; _v.Param = int32(_tempNum_) } + return +} + +func DeserializeGameOpenedCond(_buf map[string]interface{}) (*GameOpenedCond, error) { + v := &GameOpenedCond{} + if err := v.Deserialize(_buf); err == nil { + return v, nil + } else { + return nil, err + } +} diff --git a/sys/configure/structs/Tables.go b/sys/configure/structs/Tables.go index 774928597..d691ec869 100644 --- a/sys/configure/structs/Tables.go +++ b/sys/configure/structs/Tables.go @@ -57,7 +57,6 @@ type Tables struct { Playerlv *GamePlayerlv Facemod *GameFacemod Msgdistrib *GameMsgdistrib - TestFlow *GameTestFlow Opencond *GameOpencond Stroy *GameStroy Pagoda *GamePagoda @@ -435,12 +434,6 @@ func NewTables(loader JsonLoader) (*Tables, error) { if tables.Msgdistrib, err = NewGameMsgdistrib(buf) ; err != nil { return nil, err } - if buf, err = loader("game_testflow") ; err != nil { - return nil, err - } - if tables.TestFlow, err = NewGameTestFlow(buf) ; err != nil { - return nil, err - } if buf, err = loader("game_opencond") ; err != nil { return nil, err } diff --git a/sys/configure/structs/game.opencondData.go b/sys/configure/structs/game.opencondData.go index 3d6a2a42b..956f07f07 100644 --- a/sys/configure/structs/game.opencondData.go +++ b/sys/configure/structs/game.opencondData.go @@ -13,7 +13,7 @@ import "errors" type GameOpencondData struct { Id string Name string - Main int32 + Main []*GameOpenedCond Optional string Wkqbx int32 Kqbx int32 @@ -31,7 +31,20 @@ func (*GameOpencondData) GetTypeId() int32 { func (_v *GameOpencondData)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; if _v.Id, _ok_ = _buf["id"].(string); !_ok_ { err = errors.New("id error"); return } } {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["name"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Name error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Name, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["main"].(float64); !_ok_ { err = errors.New("main error"); return }; _v.Main = int32(_tempNum_) } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["main"].([]interface{}); !_ok_ { err = errors.New("main error"); return } + + _v.Main = make([]*GameOpenedCond, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ *GameOpenedCond + { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameOpenedCond(_x_); err != nil { return } } + _v.Main = append(_v.Main, _list_v_) + } + } + { var _ok_ bool; if _v.Optional, _ok_ = _buf["optional"].(string); !_ok_ { err = errors.New("optional error"); return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["wkqbx"].(float64); !_ok_ { err = errors.New("wkqbx error"); return }; _v.Wkqbx = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["kqbx"].(float64); !_ok_ { err = errors.New("kqbx error"); return }; _v.Kqbx = int32(_tempNum_) }