This commit is contained in:
liwei1dao 2022-09-06 18:02:51 +08:00
commit 42d1a3f6c2
55 changed files with 2819 additions and 3152 deletions

View File

@ -1,758 +0,0 @@
[
{
"id": 10011,
"type": 1001,
"skill_type": 1,
"initial": 1,
"level": 1,
"levelname": {
"key": "gourmet_ln1",
"text": "马马虎虎"
},
"colour": 0,
"name": {
"key": "gourmet_ln1",
"text": "魔法厨艺"
},
"needtime": 3600,
"display": 1000,
"probability": 1000,
"icon": "ty_wz_k1",
"item": [
{
"a": "item",
"t": "10002",
"n": 1
}
],
"affix": {
"key": "gourmet_ln1",
"text": "无"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10012,
"type": 1001,
"skill_type": 1,
"initial": 0,
"level": 2,
"levelname": {
"key": "gourmet_ln2",
"text": "匠心独运"
},
"colour": 0,
"name": {
"key": "gourmet_ln2",
"text": "魔法厨艺"
},
"needtime": 7200,
"display": 1000,
"probability": 500,
"icon": "ty_wz_k1",
"item": [
{
"a": "item",
"t": "10002",
"n": 1
}
],
"affix": {
"key": "gourmet_ln2",
"text": "极低"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10013,
"type": 1001,
"skill_type": 1,
"initial": 0,
"level": 3,
"levelname": {
"key": "gourmet_ln3",
"text": "孰能生巧"
},
"colour": 0,
"name": {
"key": "gourmet_ln3",
"text": "魔法厨艺"
},
"needtime": 14400,
"display": 1000,
"probability": 20,
"icon": "ty_wz_k1",
"item": [
{
"a": "item",
"t": "10002",
"n": 1
}
],
"affix": {
"key": "gourmet_ln3",
"text": "中等"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10014,
"type": 1001,
"skill_type": 1,
"initial": 0,
"level": 4,
"levelname": {
"key": "gourmet_ln4",
"text": "可圈可点"
},
"colour": 0,
"name": {
"key": "gourmet_ln4",
"text": "魔法厨艺"
},
"needtime": 28800,
"display": 1000,
"probability": 10,
"icon": "ty_wz_k1",
"item": [
{
"a": "item",
"t": "10002",
"n": 1
}
],
"affix": {
"key": "gourmet_ln4",
"text": "较高"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10021,
"type": 1002,
"skill_type": 1,
"initial": 1,
"level": 1,
"levelname": {
"key": "gourmet_ln1",
"text": "马马虎虎"
},
"colour": 0,
"name": {
"key": "gourmet_ln1",
"text": "功夫厨艺"
},
"needtime": 3600,
"display": 1000,
"probability": 1000,
"icon": "ty_wz_k1",
"item": [
{
"a": "item",
"t": "10002",
"n": 1
}
],
"affix": {
"key": "gourmet_ln1",
"text": "无"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10022,
"type": 1002,
"skill_type": 1,
"initial": 0,
"level": 2,
"levelname": {
"key": "gourmet_ln2",
"text": "匠心独运"
},
"colour": 0,
"name": {
"key": "gourmet_ln2",
"text": "功夫厨艺"
},
"needtime": 7200,
"display": 1000,
"probability": 500,
"icon": "ty_wz_k1",
"item": [
{
"a": "item",
"t": "10002",
"n": 1
}
],
"affix": {
"key": "gourmet_ln2",
"text": "极低"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10023,
"type": 1002,
"skill_type": 1,
"initial": 0,
"level": 3,
"levelname": {
"key": "gourmet_ln3",
"text": "孰能生巧"
},
"colour": 0,
"name": {
"key": "gourmet_ln3",
"text": "功夫厨艺"
},
"needtime": 14400,
"display": 1000,
"probability": 20,
"icon": "ty_wz_k1",
"item": [
{
"a": "item",
"t": "10002",
"n": 1
}
],
"affix": {
"key": "gourmet_ln3",
"text": "中等"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10024,
"type": 1002,
"skill_type": 1,
"initial": 0,
"level": 4,
"levelname": {
"key": "gourmet_ln4",
"text": "可圈可点"
},
"colour": 0,
"name": {
"key": "gourmet_ln4",
"text": "功夫厨艺"
},
"needtime": 28800,
"display": 1000,
"probability": 10,
"icon": "ty_wz_k1",
"item": [
{
"a": "item",
"t": "10002",
"n": 1
}
],
"affix": {
"key": "gourmet_ln4",
"text": "较高"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10031,
"type": 1003,
"skill_type": 1,
"initial": 1,
"level": 1,
"levelname": {
"key": "gourmet_ln1",
"text": "马马虎虎"
},
"colour": 0,
"name": {
"key": "gourmet_ln1",
"text": "科技厨艺"
},
"needtime": 3600,
"display": 1000,
"probability": 1000,
"icon": "ty_wz_k1",
"item": [
{
"a": "item",
"t": "10002",
"n": 1
}
],
"affix": {
"key": "gourmet_ln1",
"text": "无"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10032,
"type": 1003,
"skill_type": 1,
"initial": 0,
"level": 2,
"levelname": {
"key": "gourmet_ln2",
"text": "匠心独运"
},
"colour": 0,
"name": {
"key": "gourmet_ln2",
"text": "科技厨艺"
},
"needtime": 7200,
"display": 1000,
"probability": 500,
"icon": "ty_wz_k1",
"item": [
{
"a": "item",
"t": "10002",
"n": 1
}
],
"affix": {
"key": "gourmet_ln2",
"text": "极低"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10033,
"type": 1003,
"skill_type": 1,
"initial": 0,
"level": 3,
"levelname": {
"key": "gourmet_ln3",
"text": "孰能生巧"
},
"colour": 0,
"name": {
"key": "gourmet_ln3",
"text": "科技厨艺"
},
"needtime": 14400,
"display": 1000,
"probability": 20,
"icon": "ty_wz_k1",
"item": [
{
"a": "item",
"t": "10002",
"n": 1
}
],
"affix": {
"key": "gourmet_ln3",
"text": "中等"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10034,
"type": 1003,
"skill_type": 1,
"initial": 0,
"level": 4,
"levelname": {
"key": "gourmet_ln4",
"text": "可圈可点"
},
"colour": 0,
"name": {
"key": "gourmet_ln4",
"text": "科技厨艺"
},
"needtime": 28800,
"display": 1000,
"probability": 10,
"icon": "ty_wz_k1",
"item": [
{
"a": "item",
"t": "10002",
"n": 1
}
],
"affix": {
"key": "gourmet_ln4",
"text": "较高"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10041,
"type": 1004,
"skill_type": 1,
"initial": 1,
"level": 1,
"levelname": {
"key": "gourmet_ln1",
"text": "马马虎虎"
},
"colour": 0,
"name": {
"key": "gourmet_ln1",
"text": "月能厨艺"
},
"needtime": 3600,
"display": 1000,
"probability": 1000,
"icon": "ty_wz_k1",
"item": [
{
"a": "item",
"t": "10002",
"n": 1
}
],
"affix": {
"key": "gourmet_ln1",
"text": "无"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10042,
"type": 1004,
"skill_type": 1,
"initial": 0,
"level": 2,
"levelname": {
"key": "gourmet_ln2",
"text": "匠心独运"
},
"colour": 0,
"name": {
"key": "gourmet_ln2",
"text": "月能厨艺"
},
"needtime": 7200,
"display": 1000,
"probability": 500,
"icon": "ty_wz_k1",
"item": [
{
"a": "item",
"t": "10002",
"n": 1
}
],
"affix": {
"key": "gourmet_ln2",
"text": "极低"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10043,
"type": 1004,
"skill_type": 1,
"initial": 0,
"level": 3,
"levelname": {
"key": "gourmet_ln3",
"text": "孰能生巧"
},
"colour": 0,
"name": {
"key": "gourmet_ln3",
"text": "月能厨艺"
},
"needtime": 14400,
"display": 1000,
"probability": 20,
"icon": "ty_wz_k1",
"item": [
{
"a": "item",
"t": "10002",
"n": 1
}
],
"affix": {
"key": "gourmet_ln3",
"text": "中等"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10044,
"type": 1004,
"skill_type": 1,
"initial": 0,
"level": 4,
"levelname": {
"key": "gourmet_ln4",
"text": "可圈可点"
},
"colour": 0,
"name": {
"key": "gourmet_ln4",
"text": "月能厨艺"
},
"needtime": 28800,
"display": 1000,
"probability": 10,
"icon": "ty_wz_k1",
"item": [
{
"a": "item",
"t": "10002",
"n": 1
}
],
"affix": {
"key": "gourmet_ln4",
"text": "较高"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10051,
"type": 1005,
"skill_type": 2,
"initial": 1,
"level": 1,
"levelname": {
"key": "gourmet_ln1",
"text": "马马虎虎"
},
"colour": 0,
"name": {
"key": "gourmet_ln1",
"text": "高效制作"
},
"needtime": -300,
"display": 1000,
"probability": 1000,
"icon": "ty_wz_k1",
"item": [],
"affix": {
"key": "gourmet_ln1",
"text": "出餐时间-5分钟"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10052,
"type": 1005,
"skill_type": 2,
"initial": 0,
"level": 2,
"levelname": {
"key": "gourmet_ln2",
"text": "匠心独运"
},
"colour": 0,
"name": {
"key": "gourmet_ln2",
"text": "高效制作"
},
"needtime": -600,
"display": 1000,
"probability": 500,
"icon": "ty_wz_k1",
"item": [],
"affix": {
"key": "gourmet_ln2",
"text": "出餐时间-10分钟"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10053,
"type": 1005,
"skill_type": 2,
"initial": 0,
"level": 3,
"levelname": {
"key": "gourmet_ln3",
"text": "孰能生巧"
},
"colour": 0,
"name": {
"key": "gourmet_ln3",
"text": "高效制作"
},
"needtime": -900,
"display": 1000,
"probability": 20,
"icon": "ty_wz_k1",
"item": [],
"affix": {
"key": "gourmet_ln3",
"text": "出餐时间-15分钟"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
},
{
"id": 10054,
"type": 1005,
"skill_type": 2,
"initial": 0,
"level": 4,
"levelname": {
"key": "gourmet_ln4",
"text": "可圈可点"
},
"colour": 0,
"name": {
"key": "gourmet_ln4",
"text": "高效制作"
},
"needtime": -1200,
"display": 1000,
"probability": 10,
"icon": "ty_wz_k1",
"item": [],
"affix": {
"key": "gourmet_ln4",
"text": "出餐时间-20分钟"
},
"affix_colour": 0,
"consume": [
{
"a": "item",
"t": "10002",
"n": 1
}
]
}
]

View File

@ -1,7 +1,7 @@
[
{
"id": 100101,
"posTId": -1,
"preTId": -1,
"nextTId": 100102,
"cond": [
101,
@ -18,12 +18,11 @@
"t": "diamond",
"n": 10
}
],
"jump": "heronewlist"
]
},
{
"id": 100102,
"posTId": 100101,
"preTId": 100101,
"nextTId": 100103,
"cond": [
104
@ -39,37 +38,33 @@
"t": "diamond",
"n": 10
}
],
"jump": "roleupgrade"
]
},
{
"id": 100103,
"posTId": 100102,
"preTId": 100102,
"nextTId": 100104,
"cond": [
106
],
"reward": [],
"jump": "equistrengthen"
"reward": []
},
{
"id": 100104,
"posTId": 100103,
"preTId": 100103,
"nextTId": 100105,
"cond": [
108
],
"reward": [],
"jump": "roleupgrade"
"reward": []
},
{
"id": 100105,
"posTId": 100103,
"preTId": 100103,
"nextTId": -1,
"cond": [
109
],
"reward": [],
"jump": "roleupgrade"
"reward": []
}
]

View File

@ -19,7 +19,8 @@
}
],
"finish": 0,
"ending": 1
"ending": 1,
"resetto": -1
},
{
"id": 1002,
@ -41,7 +42,8 @@
}
],
"finish": 0,
"ending": 1
"ending": 1,
"resetto": -1
},
{
"id": 1003,
@ -63,7 +65,8 @@
}
],
"finish": 0,
"ending": 1
"ending": 1,
"resetto": -1
},
{
"id": 1004,
@ -72,20 +75,10 @@
100101,
100102
],
"reward": [
{
"a": "attr",
"t": "gold",
"n": 100
},
{
"a": "attr",
"t": "diamond",
"n": 10
}
],
"reward": [],
"finish": 1,
"ending": 0
"ending": 0,
"resetto": 1001
},
{
"id": 1005,
@ -94,20 +87,10 @@
100101,
100102
],
"reward": [
{
"a": "attr",
"t": "gold",
"n": 100
},
{
"a": "attr",
"t": "diamond",
"n": 10
}
],
"reward": [],
"finish": 0,
"ending": 1
"ending": 1,
"resetto": -1
},
{
"id": 1006,
@ -116,19 +99,9 @@
100101,
100102
],
"reward": [
{
"a": "attr",
"t": "gold",
"n": 100
},
{
"a": "attr",
"t": "diamond",
"n": 10
}
],
"reward": [],
"finish": 1,
"ending": 1
"ending": 1,
"resetto": -1
}
]

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,9 @@ package common
import (
"bytes"
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/sirupsen/logrus"
@ -68,3 +71,38 @@ func IsUpgrade(newVersion, oldVersion string) bool {
}
return false
}
func Copy(srcFile, destFile string) (int, error) {
input, err := ioutil.ReadFile(srcFile)
if err != nil {
logrus.Error(err)
return 0, err
}
err = ioutil.WriteFile(destFile, input, 0644)
if err != nil {
logrus.Error(err)
return 0, err
}
return len(input), nil
}
func RemoveContents(dir string) error {
d, err := os.Open(dir)
if err != nil {
return err
}
defer d.Close()
names, err := d.Readdirnames(-1)
if err != nil {
return err
}
for _, name := range names {
err = os.RemoveAll(filepath.Join(dir, name))
if err != nil {
return err
}
}
return nil
}

View File

@ -3,6 +3,7 @@ package model
type GenTool struct {
ServerAddr string //服务地址
ProjectDir string //项目目录
TmpDir string //临时目录
Client string //Client 文件路径
WorkDir string //工作目录
InputDir string //输入目录

View File

@ -10,6 +10,7 @@ import (
"go_dreamfactory/lego/core"
"go_dreamfactory/modules/friend"
"go_dreamfactory/modules/hero"
"go_dreamfactory/modules/linestory"
"go_dreamfactory/modules/mainline"
"go_dreamfactory/modules/rtask"
"go_dreamfactory/modules/task"
@ -83,6 +84,9 @@ var (
ff(comm.ModuleRtask, rtask.RtaskSubTypeChoose): &formview.RtaskChooseView{},
ff(comm.ModuleRtask, rtask.RtaskSubTypeReward): &formview.RtaskRewardView{},
ff(comm.ModuleRtask, "rtest"): &formview.RtaskTestView{},
// linestory
ff(comm.ModuleLinestory, linestory.LinestorySubTypeDostart): &formview.LinestoryStartView{},
ff(comm.ModuleLinestory, linestory.LinestorySubTypeDotask): &formview.LinestoryTaskView{},
}
)
@ -102,6 +106,7 @@ var (
string(comm.ModuleMainline),
string(comm.ModulePagoda),
string(comm.ModuleRtask),
string(comm.ModuleLinestory),
},
"gm": {ff(comm.ModuleGM, "cmd")},
"user": {
@ -165,6 +170,9 @@ var (
ff(comm.ModuleRtask, rtask.RtaskSubTypeReward),
ff(comm.ModuleRtask, "rtest"),
},
"linestory": {
ff(comm.ModuleLinestory, linestory.LinestorySubTypeDostart),
},
}
)
@ -592,6 +600,26 @@ var (
SubType: "rtest",
Enabled: true,
},
//linestory
string(comm.ModuleLinestory): {
NavLabel: "支线剧情任务",
MainType: string(comm.ModuleLinestory),
Enabled: true,
},
ff(comm.ModuleLinestory, linestory.LinestorySubTypeDostart): {
NavLabel: "启动",
Desc: "启动剧情任务",
MainType: string(comm.ModuleLinestory),
SubType: linestory.LinestorySubTypeDostart,
Enabled: true,
},
ff(comm.ModuleLinestory, linestory.LinestorySubTypeDotask): {
NavLabel: "做任务",
Desc: "做任务",
MainType: string(comm.ModuleLinestory),
SubType: linestory.LinestorySubTypeDotask,
Enabled: true,
},
}
)

View File

@ -7,12 +7,18 @@ import (
"go_dreamfactory/cmd/v2/model"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/cmd/v2/service/observer"
"go_dreamfactory/utils"
"io/ioutil"
"os/exec"
"path/filepath"
"runtime"
"time"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/data/binding"
"fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
"github.com/sirupsen/logrus"
@ -21,11 +27,17 @@ import (
type appGen struct {
appAdapter
obs observer.Observer
obs observer.Observer
goList *fileList
jsonList *fileList
goChkList *widget.List
jsonChkList *widget.List
}
func (this *appGen) LazyInit(obs observer.Observer) error {
this.obs = obs
this.goList = NewFileList()
this.jsonList = NewFileList()
this.tabItem = container.NewTabItemWithIcon(common.TOOLBAR_GEN, theme.ContentCopyIcon(), nil)
@ -64,6 +76,10 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
inputDir := widget.NewEntry()
inputDir.Text = "Datas"
tmpDir := widget.NewEntry()
tmpDir.Text = filepath.Join("c:\\tmp\\")
tmpDir.PlaceHolder = "临时目录,不要和工作目录和项目目录重复"
//genType
var genTypeText string
genType := widget.NewSelect([]string{"go", "json", "all"}, func(s string) {
@ -78,16 +94,18 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
client.Text = gt.Client //"Luban.Client\\Luban.Client.exe"
genType.Selected = gt.GenType
genTypeText = gt.GenType
tmpDir.Text = gt.TmpDir
}
form := widget.NewForm(
widget.NewFormItem("服务地址", serverAddr),
widget.NewFormItem("项目目录", projectDir),
widget.NewFormItem("工作目录", workDir),
widget.NewFormItem("Client", client),
widget.NewFormItem("LuBan Cli", client),
widget.NewFormItem("输入目录", inputDir),
widget.NewFormItem("输出Code目录", outputCodeDir),
widget.NewFormItem("输出JSON目录", outputJsonDir),
widget.NewFormItem("临时目录", tmpDir),
widget.NewFormItem("生成类型", genType),
)
@ -116,16 +134,72 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
OutputCodeDir: outputCodeDir.Text,
OutputJsonDir: outputJsonDir.Text,
GenType: genTypeText,
TmpDir: tmpDir.Text,
}); err != nil {
logrus.WithField("err", err).Debug("保存配置")
}
logrus.Debug("save luban conf")
})
//go
this.goList.titleLabel = widget.NewLabel("Go文件")
this.goList.titleLabel.Hide()
// 复选列表
this.goChkList = this.goList.createList()
// 覆盖 -go
go_overrideBtn := &widget.Button{Text: "覆盖Go", Icon: theme.ConfirmIcon()}
go_overrideBtn.Hide()
go_overrideBtn.OnTapped = func() {
go_overrideBtn.Disable()
defer func() {
go_overrideBtn.Enable()
// _ = common.RemoveContents(filepath.Join(tmpDir.Text, "go"))
}()
for _, v := range this.goList.selItemIds {
// logrus.WithField("path1", filepath.Join(tmpDir.Text, "go", v)).Debug("copy go")
// logrus.WithField("path2", filepath.Join(projectDir.Text, outputCodeDir.Text, v)).Debug("copy go")
_, err := common.Copy(filepath.Join(tmpDir.Text, "go", v),
filepath.Join(projectDir.Text, outputCodeDir.Text, v))
if err != nil {
logrus.Error(err)
}
}
}
// json
this.jsonList.titleLabel = widget.NewLabel("Json文件")
this.jsonList.titleLabel.Hide()
// 复选列表
this.jsonChkList = this.jsonList.createList()
// 覆盖 -go
json_overrideBtn := &widget.Button{Text: "覆盖Json", Icon: theme.ConfirmIcon()}
json_overrideBtn.Hide()
json_overrideBtn.OnTapped = func() {
json_overrideBtn.Disable()
defer func() {
json_overrideBtn.Enable()
// _ = common.RemoveContents(filepath.Join(tmpDir.Text, "json"))
}()
for _, v := range this.jsonList.selItemIds {
// logrus.WithField("path1", filepath.Join(tmpDir.Text, "json", v)).Debug("copy json")
// logrus.WithField("path2", filepath.Join(projectDir.Text, outputJsonDir.Text, v)).Debug("copy json")
_, err := common.Copy(filepath.Join(tmpDir.Text, "json", v),
filepath.Join(projectDir.Text, outputJsonDir.Text, v))
if err != nil {
logrus.Error(err)
}
logrus.Debug(v)
}
}
genBtn := &widget.Button{Text: "生成", Icon: theme.ConfirmIcon()}
genBtn.OnTapped = func() {
genBtn.Disable()
defer genBtn.Enable()
defer func() {
genBtn.Enable()
}()
if runtime.GOOS != "windows" {
dialog.ShowError(errors.New("no support "+runtime.GOOS), toolWin.w)
return
@ -143,8 +217,8 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
serverAddr.Text,
fmt.Sprintf("%s%s", workDir.Text, define.Text),
fmt.Sprintf("%s%s", workDir.Text, inputDir.Text),
fmt.Sprintf("%s%s", projectDir.Text, outputCodeDir.Text),
fmt.Sprintf("%s%s", projectDir.Text, outputJsonDir.Text),
fmt.Sprintf("%s%s", tmpDir.Text, "go"),
fmt.Sprintf("%s%s", tmpDir.Text, "json"),
getType(),
)
@ -154,15 +228,115 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
dialog.ShowError(err, toolWin.w)
return
}
// 更新列表
if genTypeText == "go" {
this.goList.changeItem(filepath.Join(tmpDir.Text, "go"))
this.goList.titleLabel.SetText(fmt.Sprintf("(%d/%d个)", len(this.goList.selItemIds), this.goList.fileTotal))
go_overrideBtn.Show()
this.goList.titleLabel.Show()
} else if genTypeText == "json" {
this.jsonList.changeItem(filepath.Join(tmpDir.Text, "json"))
this.jsonList.titleLabel.SetText(fmt.Sprintf("(%d/%d)", len(this.jsonList.selItemIds), this.jsonList.fileTotal))
json_overrideBtn.Show()
this.jsonList.titleLabel.Show()
}
}
c := container.NewGridWithColumns(2, saveBtn, genBtn)
content.Objects = append(content.Objects, container.NewBorder(form, c, nil, nil))
// layout
left := container.NewVBox(form, container.NewHBox(&layout.Spacer{}, saveBtn, genBtn))
right := container.NewBorder(
container.NewHBox(widget.NewLabel("Go文件"), this.goList.titleLabel, &layout.Spacer{}, widget.NewLabel("Json文件"), this.jsonList.titleLabel),
container.NewHBox(go_overrideBtn, &layout.Spacer{}, json_overrideBtn), nil, nil,
container.NewMax(
container.NewGridWithColumns(2,
container.NewVScroll(this.goChkList),
container.NewVScroll(this.jsonChkList),
)))
content.Objects = append(content.Objects, container.NewGridWithColumns(2, left, right))
this.tabItem.Content = content
return nil
}
type fileList struct {
dataBinding binding.UntypedList
selItemIds []string //选择的ID
itemListData *model.ItemModelList
fileTotal int //文件总数
titleLabel *widget.Label
}
func NewFileList() *fileList {
return &fileList{
dataBinding: binding.NewUntypedList(),
titleLabel: &widget.Label{},
}
}
func (f *fileList) createList() *widget.List {
return widget.NewListWithData(f.dataBinding,
func() fyne.CanvasObject {
return container.NewHBox(
&widget.Check{Checked: true},
// widget.NewCheck("", func(b bool) { }),
widget.NewLabelWithStyle("", fyne.TextAlignCenter, fyne.TextStyle{}),
widget.NewLabel(""),
)
},
func(data binding.DataItem, item fyne.CanvasObject) {
o, _ := data.(binding.Untyped).Get()
pd := o.(*model.ItemModel)
item.(*fyne.Container).Objects[0].(*widget.Check).OnChanged = func(b bool) {
if b {
f.selItemIds = append(f.selItemIds, pd.Id)
} else {
f.selItemIds = utils.DeleteString(f.selItemIds, pd.Id)
}
f.titleLabel.SetText(fmt.Sprintf("(%d/%d)", len(f.selItemIds), f.fileTotal))
}
item.(*fyne.Container).Objects[1].(*widget.Label).SetText(pd.Label)
},
)
}
func (f *fileList) changeItem(dir string) {
f.itemListData = model.NewItemModelList()
files, err := ioutil.ReadDir(dir)
if err != nil {
logrus.Error(err)
return
}
now := time.Now().Unix()
for _, file := range files {
if !file.IsDir() {
// 仅筛选出变更的文件
if now-file.ModTime().Unix() < 5 {
fm := &model.ItemModel{
Id: file.Name(),
Label: file.Name(),
}
f.itemListData.DataList = append(f.itemListData.DataList, fm)
f.selItemIds = append(f.selItemIds, fm.Id)
f.fileTotal++
logrus.Debugf("%v", fm.Id)
}
}
}
f.reloadListData()
}
func (f *fileList) reloadListData() {
if f.itemListData != nil {
d := f.itemListData.AsInterfaceArray()
f.dataBinding.Set(d)
}
}
func (a *appGen) GetAppName() string {
return common.TOOLBAR_GEN
}

View File

@ -0,0 +1,53 @@
package formview
import (
"errors"
"go_dreamfactory/cmd/v2/model"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/pb"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/widget"
"github.com/sirupsen/logrus"
"github.com/spf13/cast"
)
type LinestoryTaskView struct {
BaseformView
}
func (this *LinestoryTaskView) CreateView(t *model.TestCase) fyne.CanvasObject {
taskId := widget.NewEntry()
taskId.PlaceHolder = "任务ID"
subTaskId := widget.NewEntry()
subTaskId.PlaceHolder = "子任务ID"
this.form.AppendItem(widget.NewFormItem("任务ID", taskId))
this.form.AppendItem(widget.NewFormItem("子任务ID", subTaskId))
this.form.OnSubmit = func() {
if taskId.Text == "" {
dialog.ShowError(errors.New("请任务ID"), this.w)
return
}
if subTaskId.Text == "" {
dialog.ShowError(errors.New("请子任务ID"), this.w)
return
}
if err := service.GetPttService().SendToClient(
t.MainType,
t.SubType,
&pb.LinestoryDotaskReq{
TaskId: cast.ToInt32(taskId.Text),
SubtaskId: cast.ToInt32(subTaskId.Text),
},
); err != nil {
logrus.Error(err)
return
}
}
return this.form
}

View File

@ -0,0 +1,43 @@
package formview
import (
"errors"
"go_dreamfactory/cmd/v2/model"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/pb"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/widget"
"github.com/sirupsen/logrus"
"github.com/spf13/cast"
)
type LinestoryStartView struct {
BaseformView
}
func (this *LinestoryStartView) CreateView(t *model.TestCase) fyne.CanvasObject {
jqId := widget.NewEntry()
jqId.PlaceHolder = "情景ID"
this.form.AppendItem(widget.NewFormItem("情景ID", jqId))
this.form.OnSubmit = func() {
if jqId.Text == "" {
dialog.ShowError(errors.New("请情景ID"), this.w)
return
}
if err := service.GetPttService().SendToClient(
t.MainType,
t.SubType,
&pb.LinestoryStartReq{
JqId: cast.ToInt32(jqId.Text),
},
); err != nil {
logrus.Error(err)
return
}
}
return this.form
}

View File

@ -1,14 +1,12 @@
package formview
import (
"errors"
"go_dreamfactory/cmd/v2/model"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/pb"
"go_dreamfactory/utils"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/widget"
"github.com/sirupsen/logrus"
"github.com/spf13/cast"
@ -24,24 +22,32 @@ func (this *RtaskTestView) CreateView(t *model.TestCase) fyne.CanvasObject {
paramsInput := widget.NewEntry()
paramsInput.PlaceHolder = "多个数值使用,分隔"
condiInput := widget.NewEntry()
condiInput.PlaceHolder = "条件配置ID"
this.form.AppendItem(widget.NewFormItem("任务类型", rtaskTypeInput))
this.form.AppendItem(widget.NewFormItem("参数", paramsInput))
this.form.AppendItem(widget.NewFormItem("条件ID", condiInput))
this.form.OnSubmit = func() {
if rtaskTypeInput.Text == "" {
dialog.ShowError(errors.New("请填写任务类型ID"), this.w)
return
}
// if rtaskTypeInput.Text == "" {
// dialog.ShowError(errors.New("请填写任务类型ID"), this.w)
// return
// }
if paramsInput.Text == "" {
dialog.ShowError(errors.New("请填写任务条件参数"), this.w)
return
}
// if paramsInput.Text == "" {
// dialog.ShowError(errors.New("请填写任务条件参数"), this.w)
// return
// }
if err := service.GetPttService().SendToClient(
t.MainType,
t.SubType,
&pb.RtaskTestReq{RtaskType: cast.ToInt32(rtaskTypeInput.Text), Params: utils.TrInt32(paramsInput.Text)},
&pb.RtaskTestReq{
RtaskType: cast.ToInt32(rtaskTypeInput.Text),
Params: utils.TrInt32(paramsInput.Text),
CondiId: cast.ToInt32(condiInput.Text),
},
); err != nil {
logrus.Error(err)
return

View File

@ -58,6 +58,7 @@ const (
ModuleViking core.M_Modules = "viking" //维京远征
ModuleMoonfantasy core.M_Modules = "moonfantasy" //月之秘境模块
ModuleHunting core.M_Modules = "hunting" //狩猎
ModuleLinestory core.M_Modules = "linestory" //支线剧情
ModuleBattle core.M_Modules = "battle" //战斗
)
@ -129,6 +130,9 @@ const (
TableHunting = "hunting"
// 维京远征排行榜
TableHuntingRank = "huntingrank"
// 支线剧情任务
TableLinestory = "linestory"
)
//RPC服务接口定义处

View File

@ -109,10 +109,13 @@ type (
CleanData(uid string)
// 获取当前任务
GetTaskById(uid string, taskId int32) *pb.DBTask
// 获取已完成的任务列表
GetTaskFinished(uid string, taskType TaskTag) []*pb.DBTask
}
// 随机任务
IRtask interface {
CheckCondi(session IUserSession, condiId int32) (code pb.ErrorCode)
//任务触发
SendToRtask(session IUserSession, rtaskType TaskType, params ...int32) (code pb.ErrorCode)
}
@ -121,6 +124,8 @@ type (
IFriend interface {
// 重置点赞列表和每日友情点
ResetFriend(uid string)
// 获取好友数量
GetFriendCount(uid string) int32
}
//聊天系统

View File

@ -99,5 +99,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
return
}
// 拥有xx个好友
this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype10, int32(len(agreeIds)))
return
}

View File

@ -42,5 +42,7 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth
return
}
this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype13, 1)
return
}

View File

@ -98,5 +98,7 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code
return
}
// 赠送X次友情点
this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype11, 1)
return
}

View File

@ -6,8 +6,12 @@ import (
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"github.com/spf13/cast"
)
var _ comm.IFriend = (*Friend)(nil)
func NewModule() core.IModule {
m := new(Friend)
return m
@ -56,3 +60,10 @@ func (this *Friend) ResetFriend(uid string) {
}
}
func (this *Friend) GetFriendCount(uid string) (count int32) {
if friend := this.modelFriend.GetFriend(uid); friend != nil {
count = cast.ToInt32(len(friend.FriendIds))
}
return
}

29
modules/linestory/api.go Normal file
View File

@ -0,0 +1,29 @@
package linestory
import (
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
const (
LinestorySubTypeDostart = "dostart" //开始
LinestorySubTypeDotask = "dotask" //做任务
)
type apiComp struct {
modules.MCompGate
service core.IService
moduleLinestory *ModuleLinestory
}
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.MCompGate.Init(service, module, comp, options)
this.moduleLinestory = module.(*ModuleLinestory)
this.service = service
return
}
func (this *apiComp) Start() (err error) {
err = this.MCompGate.Start()
return
}

View File

@ -0,0 +1,139 @@
package linestory
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb"
"go_dreamfactory/utils"
"google.golang.org/protobuf/proto"
)
func (this *apiComp) DotaskCheck(session comm.IUserSession, req *pb.LinestoryDotaskReq) (code pb.ErrorCode) {
if req.TaskId == 0 || req.SubtaskId == 0 {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Dotask(session comm.IUserSession, req *pb.LinestoryDotaskReq) (code pb.ErrorCode, data proto.Message) {
if code = this.DotaskCheck(session, req); code != pb.ErrorCode_Success {
return
}
// task conf
conf := this.moduleLinestory.configure.getLinestoryTaskCfgById(req.TaskId)
if conf == nil {
code = pb.ErrorCode_ConfigNoFound
return
}
// stage conf
stageConf := this.moduleLinestory.configure.getLinestoryStageCfgById(req.SubtaskId)
if stageConf == nil {
code = pb.ErrorCode_ConfigNoFound
return
}
// 查询当前玩家的支线任务数据
dbLinestory := &pb.DBLinestory{}
if err := this.moduleLinestory.modelLinestory.Get(session.GetUserId(), dbLinestory); err != nil {
code = pb.ErrorCode_DBError
return
}
if dbLinestory.Tasks == nil {
dbLinestory.Tasks = make(map[int32]*pb.TaskNode)
} else {
if v, ok := dbLinestory.Tasks[req.TaskId]; ok {
// 是否被禁止进入
if v.Status == 3 {
code = pb.ErrorCode_LinestoryTaskDisabledEnter
return
}
}
}
var curTask *pb.TaskNode //当前任务
rsp := &pb.LinestoryDotaskResp{}
defer func() {
if err := session.SendMsg(string(this.moduleLinestory.GetType()), LinestorySubTypeDotask, rsp); err != nil {
code = pb.ErrorCode_SystemError
return
}
}()
//校验前置
if conf.PreTId != -1 {
if tn, ok := dbLinestory.Tasks[conf.PreTId]; !ok {
code = pb.ErrorCode_LinestoryTaskNoFinished
return
} else {
curTask = tn
// 判此任务是否是结局
if conf.Ending == 0 && conf.Resetto != -1 {
// 重置任务
for k, _ := range dbLinestory.Tasks {
if k >= conf.Resetto {
delete(dbLinestory.Tasks, k)
}
}
dbLinestory.Tasks[req.TaskId] = &pb.TaskNode{Status: 3}
}
// 判断是否最后一个 发奖励
if code = this.moduleLinestory.DispenseRes(session, conf.Reward, true); code != pb.ErrorCode_Success {
log.Errorf("%v", code)
}
}
}
// 校验子任务是否完成
if _, ok := utils.Findx(curTask.SubtaskIds, req.SubtaskId); !ok {
code = pb.ErrorCode_LinestorySubTaskNoFinished
return
}
// 校验子任务前置
if stageConf.PreTId != -1 {
module, err := this.service.GetModule(comm.ModuleRtask)
if err != nil {
code = pb.ErrorCode_SystemError
return
}
//校验子任务完成条件
if m, ok := module.(comm.IRtask); ok {
for _, condiId := range stageConf.Cond {
if code = m.CheckCondi(session, condiId); code != pb.ErrorCode_Success {
return
}
}
// 全部符合条件
curTask.SubtaskIds = append(curTask.SubtaskIds, req.SubtaskId)
if len(conf.StageTId) == len(curTask.SubtaskIds) {
curTask.Status = 2 //完成
} else {
curTask.Status = 1 //进行中
}
dbLinestory.Tasks[conf.PreTId] = curTask
}
}
// 更新子任务
update := map[string]interface{}{
"tasks": dbLinestory.Tasks,
}
if err := this.moduleLinestory.modelLinestory.Change(session.GetUserId(), update); err != nil {
code = pb.ErrorCode_DBError
return
}
if stageConf.NextTId == -1 {
//派发奖励
code = this.moduleLinestory.DispenseRes(session, stageConf.Reward, true)
}
return
}

View File

@ -0,0 +1,74 @@
package linestory
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"google.golang.org/protobuf/proto"
)
func (this *apiComp) DostartCheck(session comm.IUserSession, req *pb.LinestoryStartReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) Dostart(session comm.IUserSession, req *pb.LinestoryStartReq) (code pb.ErrorCode, data proto.Message) {
conf := this.moduleLinestory.configure.getLinestoryChapterCfgById(req.JqId)
if conf == nil {
code = pb.ErrorCode_ConfigNoFound
return
}
module, err := this.service.GetModule(comm.ModuleRtask)
if err != nil {
code = pb.ErrorCode_SystemError
return
}
if m, ok := module.(comm.IRtask); ok {
// 校验限定条件
for _, condiId := range conf.Cond {
if code = m.CheckCondi(session, condiId); code != pb.ErrorCode_Success {
return
}
}
}
rsp := &pb.LinestoryStartResp{
JqId: req.JqId,
}
defer func() {
if err := session.SendMsg(string(this.moduleLinestory.GetType()), LinestorySubTypeDostart,
rsp); err != nil {
code = pb.ErrorCode_SystemError
}
}()
dbLinestory := &pb.DBLinestory{}
if err := this.moduleLinestory.modelLinestory.Get(session.GetUserId(), dbLinestory); err != nil {
if err == mongo.ErrNoDocuments {
//创建任务记录
if err := this.moduleLinestory.modelLinestory.Add(session.GetUserId(), &pb.DBLinestory{
Id: primitive.NewObjectID().Hex(),
Uid: session.GetUserId(),
JqId: req.JqId,
}); err != nil {
code = pb.ErrorCode_DBError
return
}
} else {
code = pb.ErrorCode_DBError
return
}
}
if dbLinestory.Tasks != nil {
for k, _ := range dbLinestory.Tasks {
rsp.TaskIds = append(rsp.TaskIds, k)
}
}
return
}

113
modules/linestory/config.go Normal file
View File

@ -0,0 +1,113 @@
package linestory
import (
"fmt"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
)
const (
gameLinestoryChapter = "game_linestorychapter.json"
gameLinestoryTask = "game_linestorytask.json"
gameLinestoryStagetask = "game_linestorystagetask.json"
)
type configureComp struct {
modules.MCompConfigure
}
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.MCompConfigure.Init(service, module, comp, options)
err = this.LoadMultiConfigure(map[string]interface{}{
gameLinestoryChapter: cfg.NewGameLineStoryChapter,
gameLinestoryTask: cfg.NewGameLineStoryTask,
gameLinestoryStagetask: cfg.NewGameLineStoryStageTask,
})
return
}
func (this *configureComp) getLinestoryChapterCfg() (data *cfg.GameLineStoryChapter, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameLinestoryChapter); err != nil {
return
} else {
if data, ok = v.(*cfg.GameLineStoryChapter); !ok {
err = fmt.Errorf("%T no is *cfg.GameLineStoryChapter", v)
return
}
}
return
}
func (this *configureComp) getLinestoryTaskCfg() (data *cfg.GameLineStoryTask, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameLinestoryTask); err != nil {
return
} else {
if data, ok = v.(*cfg.GameLineStoryTask); !ok {
err = fmt.Errorf("%T no is *cfg.GameLineStoryTask", v)
return
}
}
return
}
func (this *configureComp) getLinestoryStageCfg() (data *cfg.GameLineStoryStageTask, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameLinestoryStagetask); err != nil {
return
} else {
if data, ok = v.(*cfg.GameLineStoryStageTask); !ok {
err = fmt.Errorf("%T no is *cfg.GameLineStoryStageTask", v)
return
}
}
return
}
func (this *configureComp) getLinestoryChapterCfgById(id int32) (data *cfg.GameLineStoryChapterData) {
if cfg, err := this.getLinestoryChapterCfg(); err != nil {
log.Errorf("%v", err)
return
} else {
if cfg != nil {
data = cfg.GetDataMap()[id]
}
}
return
}
func (this *configureComp) getLinestoryTaskCfgById(id int32) (data *cfg.GameLineStoryTaskData) {
if cfg, err := this.getLinestoryTaskCfg(); err != nil {
log.Errorf("%v", err)
return
} else {
if cfg != nil {
data = cfg.GetDataMap()[id]
}
}
return
}
func (this *configureComp) getLinestoryStageCfgById(id int32) (data *cfg.GameLineStoryStageTaskData) {
if cfg, err := this.getLinestoryStageCfg(); err != nil {
log.Errorf("%v", err)
return
} else {
if cfg != nil {
data = cfg.GetDataMap()[id]
}
}
return
}

View File

@ -0,0 +1,21 @@
package linestory
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
type ModelLinestory struct {
modules.MCompModel
moduleLinestory *ModuleLinestory
service core.IService
}
func (this *ModelLinestory) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.TableName = comm.TableLinestory
err = this.MCompModel.Init(service, module, comp, options)
this.moduleLinestory = module.(*ModuleLinestory)
this.service = service
return
}

View File

@ -0,0 +1,34 @@
package linestory
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
type ModuleLinestory struct {
modules.ModuleBase
api *apiComp
configure *configureComp
modelLinestory *ModelLinestory
}
func NewModule() core.IModule {
return &ModuleLinestory{}
}
func (this *ModuleLinestory) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
return
}
func (this *ModuleLinestory) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelLinestory = this.RegisterComp(new(ModelLinestory)).(*ModelLinestory)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}
func (this *ModuleLinestory) GetType() core.M_Modules {
return comm.ModuleLinestory
}

View File

@ -2,8 +2,10 @@ package rtask
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb"
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
)
@ -12,9 +14,19 @@ func (this *apiComp) RtestCheck(session comm.IUserSession, req *pb.RtaskTestReq)
}
func (this *apiComp) Rtest(session comm.IUserSession, req *pb.RtaskTestReq) (code pb.ErrorCode, data proto.Message) {
code = this.moduleRtask.SendToRtask(session, comm.TaskType(req.RtaskType), req.Params...)
rsp := &pb.RtaskTestResp{Flag: true}
if req.CondiId != 0 {
if err, ok := this.moduleRtask.modelRtask.checkCondi(session.GetUserId(), req.CondiId); !ok {
rsp.Flag = false
log.Errorf("%v", errors.WithMessage(err, session.GetUserId()))
}
} else {
if code = this.moduleRtask.SendToRtask(session, comm.TaskType(req.RtaskType), req.Params...); code != pb.ErrorCode_Success {
rsp.Flag = false
}
}
if err := session.SendMsg(string(this.moduleRtask.GetType()), "rtasktest", &pb.RtaskTestResp{Flag: true}); err != nil {
if err := session.SendMsg(string(this.moduleRtask.GetType()), "rtest", rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return

View File

@ -13,19 +13,116 @@ func (this *ModelRtaskRecord) equalParams(cfg *cfg.GameRdtaskCondiData, vals ...
return
}
if paramLen == 1 {
if vals[0] == cfg.Data1 {
condiId = cfg.Id
switch paramLen {
case 1:
if !soEqual(vals[0], cfg.Data1) {
return
}
} else if paramLen == 2 {
if vals[0] == cfg.Data1 && vals[1] == cfg.Data2 {
condiId = cfg.Id
case 2:
if !(soEqual(vals[0], cfg.Data1) && soEqual(vals[1], cfg.Data2)) {
return
}
} else if paramLen == 3 {
if vals[0] == cfg.Data1 && vals[1] == cfg.Data2 && vals[2] == cfg.Data3 {
condiId = cfg.Id
case 3:
if !(soEqual(vals[0], cfg.Data1) && soEqual(vals[1], cfg.Data2) && soEqual(vals[2], cfg.Data3)) {
return
}
case 4:
if !(soEqual(vals[0], cfg.Data1) && soEqual(vals[1], cfg.Data2) &&
soEqual(vals[2], cfg.Data3) && soEqual(vals[3], cfg.Data4)) {
return
}
case 5:
if !(soEqual(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:
return
}
condiId = cfg.Id
return
}
func (this *ModelRtaskRecord) greatThanParams(cfg *cfg.GameRdtaskCondiData, vals ...int32) (condiId int32) {
var (
err error
paramLen int
)
if paramLen, err = verifyParam(cfg, vals...); err != nil {
return
}
switch paramLen {
case 1:
if !soGreatThan(vals[0], cfg.Data1) {
return
}
case 2:
if !(soGreatThan(vals[0], cfg.Data1) && soGreatThan(vals[1], cfg.Data2)) {
return
}
case 3:
if !(soGreatThan(vals[0], cfg.Data1) && soGreatThan(vals[1], cfg.Data2) && soGreatThan(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)) {
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)) {
return
}
default:
return
}
condiId = cfg.Id
return
}
// 需要累加更新的查询
func (this *ModelRtaskRecord) lessThanParams(cfg *cfg.GameRdtaskCondiData, vals ...int32) (condiId int32) {
var (
err error
paramLen int
)
if paramLen, err = verifyParam(cfg, vals...); err != nil {
return
}
switch paramLen {
case 1:
if !soLessThan(vals[0], cfg.Data1) {
return
}
case 2:
if !(soLessThan(vals[0], cfg.Data1) && soLessThan(vals[1], cfg.Data2)) {
return
}
case 3:
if !(soLessThan(vals[0], cfg.Data1) && soLessThan(vals[1], cfg.Data2) && soLessThan(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)) {
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)) {
return
}
default:
return
}
condiId = cfg.Id
return
return
}

View File

@ -2,6 +2,7 @@ package rtask
import (
"fmt"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
@ -9,14 +10,23 @@ import (
)
func verifyParam(cfg *cfg.GameRdtaskCondiData, vals ...int32) (n int, err error) {
// if cfg.Data1 != 0 && cfg.Data2 != 0 && cfg.Data3 != 0 {
// if len(vals) != 3 {
// err = errors.New(fmt.Sprintf("参数个数不一致,期望3实际是%v", len(vals)))
// return
// } else {
// n = len(vals)
// }
// }
if cfg.Data1 != 0 && cfg.Data2 != 0 && cfg.Data3 != 0 && cfg.Data4 != 0 && cfg.Data5 != 0 {
if len(vals) != 5 {
err = errors.New(fmt.Sprintf("参数个数不一致,期望5实际是%v", len(vals)))
return
} else {
n = len(vals)
}
}
if cfg.Data1 != 0 && cfg.Data2 != 0 && cfg.Data3 != 0 && cfg.Data4 != 0 {
if len(vals) != 4 {
err = errors.New(fmt.Sprintf("参数个数不一致,期望4实际是%v", len(vals)))
return
} else {
n = len(vals)
}
}
if cfg.Data1 != 0 && cfg.Data2 != 0 && cfg.Data3 != 0 {
if len(vals) != 3 {
@ -63,32 +73,102 @@ func toArr(m map[int32]int32) (params []int32) {
return
}
func isEqual(len int, data *pb.RtaskData, cfg *cfg.GameRdtaskCondiData, vals ...int32) map[int32]int32 {
func hasUpdateData(len int, data *pb.RtaskData, vals ...int32) map[int32]int32 {
if data == nil || len == 0 {
return nil
}
res := make(map[int32]int32)
if len == 1 {
if data.Data[0] != cfg.Data1 {
switch len {
case 1:
if vals[0] > data.Data[0] {
res[0] = vals[0]
}
}
if len == 2 {
if data.Data[0] != cfg.Data1 || data.Data[1] != cfg.Data2 {
case 2:
if vals[0] > data.Data[0] {
res[0] = vals[0]
} else if vals[1] > data.Data[1] {
res[1] = vals[1]
}
}
if len == 3 {
if data.Data[0] != cfg.Data1 || data.Data[1] != cfg.Data2 || data.Data[2] != cfg.Data3 {
case 3:
if vals[0] > data.Data[0] {
res[0] = vals[0]
} else if vals[1] > data.Data[1] {
res[1] = vals[1]
} else if vals[2] > data.Data[2] {
res[2] = vals[2]
}
case 4:
if vals[0] > data.Data[0] {
res[0] = vals[0]
} else if vals[1] > data.Data[1] {
res[1] = vals[1]
} else if vals[2] > data.Data[2] {
res[2] = vals[2]
} else if vals[3] > data.Data[3] {
res[3] = vals[3]
}
case 5:
if vals[0] > data.Data[0] {
res[0] = vals[0]
} else if vals[1] > data.Data[1] {
res[1] = vals[1]
} else if vals[2] > data.Data[2] {
res[2] = vals[2]
} else if vals[3] > data.Data[3] {
res[3] = vals[3]
} else if vals[4] > data.Data[4] {
res[4] = vals[4]
}
}
return res
}
func printCondiLog(uid string, cfg *cfg.GameRdtaskCondiData) {
log.Infof("uid:%v condiId:%v rtype:%v", uid, cfg.Id, cfg.Type)
}
type Num interface {
~int32 | ~string | ~bool
}
func equal[T Num](actual, expected T) bool {
return actual == expected
}
func greatThan(actual, expected int32) bool {
return actual >= expected
}
func lessThan(actual, expected int32) bool {
return actual <= expected
}
func soEqual[T Num](actual T, expected T) (ok bool) {
if !equal(actual, expected) {
log.Debugf("实际:%v 期望:%v", actual, expected)
return
}
ok = true
return
}
func soGreatThan(actual, expected int32) (ok bool) {
if !greatThan(actual, expected) {
log.Debugf("实际:%v 期望:%v", actual, expected)
return
}
ok = true
return
}
func soLessThan(actual, expected int32) (ok bool) {
if !lessThan(actual, expected) {
log.Debugf("实际:%v 期望:%v", actual, expected)
return
}
ok = true
return
}

View File

@ -72,38 +72,12 @@ func (this *ModelRtask) checkCondi(uid string, condiId int32) (err error, ok boo
//验证限定条件
var condi *rtaskCondi
if condi, ok = this.moduleRtask.handleMap[condiId]; ok {
if err, ok = condi.verify(uid, condi.cfg); !ok {
err = errors.WithMessagef(err, "uid: %v do rtask %v condition not reach", uid, condiId)
return
}
return
}
return
}
// 任务记录
func (this *ModelRtask) findAndUpdate(uid string, rtypeId comm.TaskType, vals ...int32) (err error) {
var (
condiId int32
condi *rtaskCondi
)
// 遍历当前已注册的任务条件
for _, v := range this.moduleRtask.handleMap {
// 找到任务类型
if int32(rtypeId) == v.cfg.Type {
if condiId = v.find(v.cfg, vals...); condiId == 0 {
continue
} else {
condi = v
break
if condi.verify != nil {
if err, ok = condi.verify(uid, condi.cfg); !ok {
err = errors.WithMessagef(err, "uid: %v do rtask %v condition not reach", uid, condiId)
return
}
}
}
// update
if condiId != 0 {
err = condi.update(uid, condi.cfg, vals...)
}
return
}

View File

@ -10,6 +10,8 @@ import (
cfg "go_dreamfactory/sys/configure/structs"
)
var _ comm.IRtask = (*ModuleRtask)(nil)
// 限定条件
type rtaskCondi struct {
cfg *cfg.GameRdtaskCondiData
@ -76,180 +78,465 @@ func (this *ModuleRtask) initRtaskVerifyHandle() {
case comm.Rtype1:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
verify: this.modelRtaskRecord.verify,
find: this.modelRtaskRecord.equalParams,
update: this.modelRtaskRecord.overrideUpdate,
verify: this.modelRtask.verfiyRtype1,
})
case comm.Rtype2:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
verify: this.modelRtaskRecord.verify,
find: this.modelRtaskRecord.equalParams,
update: this.modelRtaskRecord.overrideUpdate,
verify: this.modelRtask.verifyRtype2,
})
case comm.Rtype3:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
verify: this.modelRtaskRecord.verify,
find: this.modelRtaskRecord.equalParams,
update: this.modelRtaskRecord.overrideUpdate,
verify: this.modelRtask.verifyRtype3,
})
case comm.Rtype4:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
verify: this.modelRtaskRecord.verify,
find: this.modelRtaskRecord.equalParams,
update: this.modelRtaskRecord.overrideUpdate,
verify: this.modelRtask.verifyRtype4,
})
case comm.Rtype5:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
verify: this.modelRtaskRecord.verify,
find: this.modelRtaskRecord.equalParams,
update: this.modelRtaskRecord.overrideUpdate,
verify: this.modelRtask.verifyRtype5,
})
case comm.Rtype6:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verify,
update: this.modelRtaskRecord.overrideUpdate,
verify: this.modelRtask.verifyRtype6,
})
case comm.Rtype7:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verify,
update: this.modelRtaskRecord.overrideUpdate,
verify: this.modelRtask.verfiyRtype7,
})
case comm.Rtype8:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verify,
update: this.modelRtaskRecord.addUpdate,
verify: this.modelRtask.verfiyRtype8,
})
case comm.Rtype9:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verify,
update: this.modelRtaskRecord.overrideUpdate,
verify: this.modelRtask.verfiyRtype9,
})
case comm.Rtype10:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verify,
update: this.modelRtaskRecord.overrideUpdate,
verify: this.modelRtask.verfiyRtype10,
})
case comm.Rtype11:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verify,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype12:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verify,
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.equalParams,
verify: this.modelRtaskRecord.verify,
find: this.modelRtaskRecord.lessThanParams,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype14:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verify,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype15:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verify,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype16:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verify,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype17:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verify,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype18:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verify,
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.verify,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype20:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verify,
update: this.modelRtaskRecord.overrideUpdate,
verify: this.modelRtask.verifyRtype20,
})
case comm.Rtype21:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verify,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype22:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verify,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype23:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verify,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype24:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verify,
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.verify,
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,
})
case comm.Rtype35:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
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,
find: this.modelRtaskRecord.equalParams,
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:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype61:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
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,
find: this.modelRtaskRecord.equalParams,
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,
})
default:
log.Warnf("%v rtask type not configure", typeCfg.Type)
log.Warnf("rtaskType[%v] not register", typeCfg.Type)
}
}
}
@ -257,8 +544,45 @@ func (this *ModuleRtask) initRtaskVerifyHandle() {
}
func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.TaskType, params ...int32) (code pb.ErrorCode) {
if err := this.modelRtask.findAndUpdate(session.GetUserId(), rtaskType, params...); err != nil {
code = pb.ErrorCode_DBError
var (
condiId int32
condi *rtaskCondi
)
for _, v := range this.handleMap {
// 找到任务类型
if int32(rtaskType) == v.cfg.Type {
if v.find == nil {
break
}
if condiId = v.find(v.cfg, params...); condiId == 0 {
continue
} else {
condi = v
break
}
}
}
if condiId == 0 {
log.Debugf("condi not found, typeId: %v params: %v", rtaskType, params)
code = pb.ErrorCode_ConfigNoFound
return
}
// update
if condi.update != nil {
if err := condi.update(session.GetUserId(), condi.cfg, params...); err != nil {
code = pb.ErrorCode_DBError
}
}
return
}
func (this *ModuleRtask) CheckCondi(session comm.IUserSession, condiId int32) (code pb.ErrorCode) {
if _, ok := this.modelRtask.checkCondi(session.GetUserId(), condiId); !ok {
code = pb.ErrorCode_RtaskCondiNoReach
}
return
}

View File

@ -4,6 +4,7 @@ package rtask
import (
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"time"
"github.com/pkg/errors"
"go.mongodb.org/mongo-driver/bson/primitive"
@ -28,28 +29,40 @@ func (this *ModelRtaskRecord) overrideUpdate(uid string, cfg *cfg.GameRdtaskCond
if record.Vals == nil {
data := &pb.RtaskData{
Data: toMap(vals...),
Rtype: cfg.Type,
Data: toMap(vals...),
Timestamp: time.Now().Unix(),
}
record.Vals = map[int32]*pb.RtaskData{
cfg.Id: data,
}
record.Id = primitive.NewObjectID().Hex()
record.Uid = uid
record.RType = cfg.Type
if err := this.Add(uid, record); err != nil {
return errors.Wrapf(err, "添加玩家任务记录 err: %v rtype[%v]", uid, cfg.Id)
}
} else {
if v, ok := record.Vals[cfg.Id]; ok {
m := isEqual(paramLen, v, cfg, vals...)
m := hasUpdateData(paramLen, v, vals...)
if len(m) > 0 {
update := map[string]interface{}{
"vals": m,
}
err = this.Change(uid, update)
}
} else {
data := &pb.RtaskData{
Rtype: cfg.Type,
Data: toMap(vals...),
Timestamp: time.Now().Unix(),
}
record.Vals[cfg.Id] = data
update := map[string]interface{}{
"vals": record.Vals,
}
err = this.Change(uid, update)
}
}

View File

@ -2,13 +2,17 @@
package rtask
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"go_dreamfactory/utils"
"github.com/pkg/errors"
"github.com/spf13/cast"
)
func (this *ModelRtaskRecord) verify(uid string, cfg *cfg.GameRdtaskCondiData) (err error, ok bool) {
// 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 {
if len(rd.Data) == 0 {
@ -29,3 +33,240 @@ func (this *ModelRtaskRecord) verify(uid string, cfg *cfg.GameRdtaskCondiData) (
}
return
}
// 英雄指定
func (this *ModelRtask) verfiyRtype1(uid string, cfg *cfg.GameRdtaskCondiData) (err error, ok bool) {
heroModule, err := this.service.GetModule(comm.ModuleHero)
if err != nil {
return nil, false
}
if h, y := heroModule.(comm.IHero); y {
for _, v := range h.GetHeroList(uid) {
if cast.ToString(cfg.Data1) == v.HeroID {
ok = true
return
}
}
}
return
}
// 剧情
func (this *ModelRtask) verifyRtype2(uid string, cfg *cfg.GameRdtaskCondiData) (err error, ok bool) {
m, err := this.service.GetModule(comm.ModuleMainline)
if err != nil {
return
}
if ml, y := m.(comm.IMainline); y {
qjId := ml.GetUsermainLineData(uid)
return nil, qjId == cfg.Data1
}
return
}
// 每日任务
func (this *ModelRtask) verifyRtype3(uid string, cfg *cfg.GameRdtaskCondiData) (err error, ok bool) {
m, err := this.service.GetModule(comm.ModuleTask)
if err != nil {
return
}
if ml, y := m.(comm.ITask); y {
for _, task := range ml.GetTaskFinished(uid, comm.TASK_DAILY) {
if task.TaskId >= cfg.Data1 {
ok = true
break
}
}
}
return
}
// 指定英雄等级
func (this *ModelRtask) verifyRtype4(uid string, cfg *cfg.GameRdtaskCondiData) (err error, ok bool) {
defer printCondiLog(uid, cfg)
m, err := this.service.GetModule(comm.ModuleHero)
if err != nil {
return
}
if ml, y := m.(comm.IHero); y {
var hero *pb.DBHero
for _, v := range ml.GetHeroList(uid) {
if cast.ToString(cfg.Data1) == v.HeroID {
hero = v
break
}
}
if hero != nil {
return nil, soEqual(hero.HeroID, cast.ToString(cfg.Data1)) &&
soEqual(hero.Lv, cfg.Data2)
}
}
return
}
// 指定英雄的指定装备数量
func (this *ModelRtask) verifyRtype5(uid string, cfg *cfg.GameRdtaskCondiData) (err error, ok bool) {
defer printCondiLog(uid, cfg)
m, err := this.service.GetModule(comm.ModuleHero)
if err != nil {
return
}
if ml, y := m.(comm.IHero); y {
var hero *pb.DBHero
for _, v := range ml.GetHeroList(uid) {
if cast.ToString(cfg.Data1) == v.HeroID {
hero = v
break
}
}
var count int32
if hero != nil {
for _, v := range hero.EquipID {
if v != "" {
count++
}
}
}
return nil, soEqual(hero.HeroID, cast.ToString(cfg.Data1)) &&
soEqual(count, cfg.Data2)
}
return
}
// 指定英雄星级
func (this *ModelRtask) verifyRtype6(uid string, cfg *cfg.GameRdtaskCondiData) (err error, ok bool) {
defer printCondiLog(uid, cfg)
m, err := this.service.GetModule(comm.ModuleHero)
if err != nil {
return
}
if ml, y := m.(comm.IHero); y {
var hero *pb.DBHero
for _, v := range ml.GetHeroList(uid) {
if cast.ToString(cfg.Data1) == v.HeroID {
hero = v
break
}
}
if hero != nil {
return nil, soEqual(hero.HeroID, cast.ToString(cfg.Data1)) &&
soEqual(hero.Star, cfg.Data2)
}
}
return
}
// 日常登录一次
func (this *ModelRtask) verfiyRtype7(uid string, cfg *cfg.GameRdtaskCondiData) (err error, ok bool) {
defer printCondiLog(uid, cfg)
userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
}
if um, y := userModule.(comm.IUser); y {
if user := um.GetUser(uid); user != nil {
return nil, soEqual(utils.IsToday(user.Logintime), true)
}
}
return
}
// 累计登陆xx天
func (this *ModelRtask) verfiyRtype8(uid string, cfg *cfg.GameRdtaskCondiData) (err error, ok bool) {
defer printCondiLog(uid, cfg)
userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
}
if um, y := userModule.(comm.IUser); y {
ud, err := um.GetUserExpand(uid)
if err != nil {
return err, false
}
return nil, soEqual(ud.LoginAddCount, cfg.Data1)
}
return
}
// 连续登陆xx天
func (this *ModelRtask) verfiyRtype9(uid string, cfg *cfg.GameRdtaskCondiData) (err error, ok bool) {
defer printCondiLog(uid, cfg)
userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
}
if um, y := userModule.(comm.IUser); y {
ud, err := um.GetUserExpand(uid)
if err != nil {
return err, false
}
return nil, soEqual(ud.LoginContinueCount, cfg.Data1)
}
return
}
// 拥有xx个好友
func (this *ModelRtask) verfiyRtype10(uid string, cfg *cfg.GameRdtaskCondiData) (err error, ok bool) {
defer printCondiLog(uid, cfg)
m, err := this.service.GetModule(comm.ModuleFriend)
if err != nil {
return
}
if mi, y := m.(comm.IFriend); y {
count := mi.GetFriendCount(uid)
return nil, soGreatThan(count, cfg.Data1)
}
return
}
// 用户等级达到xx级
func (this *ModelRtask) verifyRtype20(uid string, cfg *cfg.GameRdtaskCondiData) (err error, ok bool) {
defer printCondiLog(uid, cfg)
userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
}
if um, y := userModule.(comm.IUser); y {
if user := um.GetUser(uid); user != nil {
return nil, soEqual(user.Lv, cfg.Data1)
}
}
return
}
// 日常任务活跃度达到xx
func (this *ModelRtask) verifyRtype63(uid string, cfg *cfg.GameRdtaskCondiData) (err error, ok bool) {
userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
}
if um, y := userModule.(comm.IUser); y {
de, err := um.GetUserExpand(uid)
if err != nil {
return err, false
}
if de != nil {
if de.Activeday == cfg.Data1 {
ok = true
}
}
}
return
}

View File

@ -54,7 +54,7 @@ func TestVerify2(t *testing.T) {
Type: 1,
Data1: 25001,
}
err, ok := rtask.verify("11", conf)
err, ok := rtask.verifyFromDb("11", conf)
So(err, ShouldEqual, nil)
So(ok, ShouldEqual, true)

View File

@ -148,6 +148,17 @@ func (this *ModelTask) getUserTask(uid string, taskId string) *pb.DBTask {
return userTask
}
// 获取已完成的任务
func (this *ModelTask) getFinishTasks(uid string, taskTag comm.TaskTag) (list []*pb.DBTask) {
taskList := this.getTaskListByTag(uid, taskTag)
for _, v := range taskList {
if v.Status == 1 {
list = append(list, v)
}
}
return
}
// 获取待处理的任务
func (this *ModelTask) getUnFinishTasks(uid string, taskId int32) (list []*pb.DBTask) {
taskList := this.getTaskById(uid, taskId)

View File

@ -10,6 +10,8 @@ import (
"go_dreamfactory/pb"
)
var _ comm.ITask = (*ModuleTask)(nil)
type ModuleTask struct {
modules.ModuleBase
modelTask *ModelTask
@ -110,6 +112,10 @@ func (this *ModuleTask) SendToTask(session comm.IUserSession, taskType comm.Task
if err := session.SendMsg(string(comm.ModuleTask), TaskSubTypeFinishedPush, &pb.TaskFinishedPush{TaskId: t.TaskId}); err != nil {
this.modelTask.moduleTask.Errorf("SendToTask sendmsg err:%v", err)
}
// 每日任务
if t.Tag == int32(comm.TASK_DAILY) {
this.ModuleRtask.SendToRtask(session, comm.Rtype3, t.TaskId)
}
}
}
return
@ -157,3 +163,7 @@ func (this *ModuleTask) initTaskHandle() {
}
}
}
func (this *ModuleTask) GetTaskFinished(uid string, taskTage comm.TaskTag) []*pb.DBTask {
return this.modelTask.getFinishTasks(uid, taskTage)
}

View File

@ -105,7 +105,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
}
if this.module.modelUser.isLoginFirst(lastLoginTime) {
this.module.ModuleRtask.SendToRtask(session, comm.Rtype7, 1)
this.module.modelExpand.updateLoginDay(user.Uid, lastLoginTime)
//清空日常
this.module.ModuleTask.ResetTask(user.Uid, comm.TASK_DAILY)
//清周常

View File

@ -5,6 +5,7 @@ import (
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go_dreamfactory/utils"
"go.mongodb.org/mongo-driver/mongo"
)
@ -50,3 +51,21 @@ func (this *ModelExpand) ChangeUserExpand(uid string, value map[string]interface
return this.module.modelExpand.Change(uid, value)
}
// 累计登录天数
func (this *ModelExpand) updateLoginDay(uid string, timestamp int64) (err error) {
var de *pb.DBUserExpand
if de, err = this.GetUserExpand(uid); err == nil {
count := de.LoginAddCount + 1
update := map[string]interface{}{
"loginAddCount": count,
}
// 更新连续等登录天数
if utils.IsYestoday(timestamp) {
update["loginContinueCount"] = de.LoginContinueCount + 1
}
err = this.ChangeUserExpand(uid, update)
}
return
}

View File

@ -10,6 +10,8 @@ import (
"go_dreamfactory/lego/sys/event"
)
var _ comm.IUser = (*User)(nil)
func NewModule() core.IModule {
m := new(User)
return m

View File

@ -165,12 +165,15 @@ const (
ErrorCode_VikingBoosType ErrorCode = 2302 // BOSS 类型不对
ErrorCode_VikingBuyMaxCount ErrorCode = 2303 // 购买达到最大次数
// moonfantasy 月之秘境
ErrorCode_MoonfantasyHasExpired ErrorCode = 2401 // boos 连接已失效
ErrorCode_MoonfantasyJoinUp ErrorCode = 2402 // boos 参与人数已达上限
ErrorCode_MoonfantasyDareUp ErrorCode = 2403 // boos 挑战次数已达上限
ErrorCode_MoonfantasyBattleNoEnd ErrorCode = 2404 // boos 战斗未结束
ErrorCode_MoonfantasyBattleNoWin ErrorCode = 2405 // boos 战斗魏未胜利
ErrorCode_BattleNoFoundRecord ErrorCode = 2501 // 未找到记录
ErrorCode_MoonfantasyHasExpired ErrorCode = 2401 // boos 连接已失效
ErrorCode_MoonfantasyJoinUp ErrorCode = 2402 // boos 参与人数已达上限
ErrorCode_MoonfantasyDareUp ErrorCode = 2403 // boos 挑战次数已达上限
ErrorCode_MoonfantasyBattleNoEnd ErrorCode = 2404 // boos 战斗未结束
ErrorCode_MoonfantasyBattleNoWin ErrorCode = 2405 // boos 战斗魏未胜利
ErrorCode_BattleNoFoundRecord ErrorCode = 2501 // 未找到记录
ErrorCode_LinestoryTaskNoFinished ErrorCode = 2601 //任务未完成
ErrorCode_LinestorySubTaskNoFinished ErrorCode = 2602 //子任务未完成
ErrorCode_LinestoryTaskDisabledEnter ErrorCode = 2603 //禁止进入
)
// Enum value maps for ErrorCode.
@ -309,141 +312,147 @@ var (
2404: "MoonfantasyBattleNoEnd",
2405: "MoonfantasyBattleNoWin",
2501: "BattleNoFoundRecord",
2601: "LinestoryTaskNoFinished",
2602: "LinestorySubTaskNoFinished",
2603: "LinestoryTaskDisabledEnter",
}
ErrorCode_value = map[string]int32{
"Success": 0,
"NoFindService": 10,
"NoFindServiceHandleFunc": 11,
"RpcFuncExecutionError": 12,
"CacheReadError": 13,
"SqlExecutionError": 14,
"ReqParameterError": 15,
"SignError": 16,
"InsufficientPermissions": 17,
"NoLogin": 18,
"UserSessionNobeing": 19,
"StateInvalid": 20,
"DBError": 21,
"SystemError": 22,
"DecodeError": 23,
"TimestampTimeout": 24,
"PbError": 25,
"AgentUidEmpty": 26,
"Exception": 100,
"Unknown": 101,
"ResNoEnough": 102,
"ConfigurationException": 103,
"ConfigNoFound": 104,
"SecKeyInvalid": 1000,
"SecKey": 1001,
"BindUser": 1002,
"GoldNoEnough": 1003,
"DiamondNoEnough": 1004,
"RoleCreated": 1005,
"UserNickNameExist": 1006,
"VeriCodeNoValid": 1007,
"VeriCodeExpired": 1008,
"UserResetData": 1009,
"UserModiNameCount": 1010,
"UserNickNameEmpty": 1011,
"UserExpandNull": 1012,
"FriendNotSelf": 1100,
"FriendSelfMax": 1101,
"FriendTargetMax": 1102,
"FriendSelfNoData": 1103,
"FriendTargetNoData": 1104,
"FriendYet": 1105,
"FriendApplyYet": 1106,
"FriendSelfBlackYet": 1107,
"FriendTargetBlackYet": 1108,
"FriendApplyError": 1109,
"FriendBlackMax": 1110,
"FriendSearchNameEmpty": 1111,
"FriendZaned": 1112,
"FriendZanreceived": 1113,
"FriendZanSelf": 1114,
"FriendPointLimit": 1115,
"ItemsNoEnough": 1200,
"ItemsNoFoundGird": 1201,
"ItemsGridNumUpper": 1202,
"ItemsGirdAmountUpper": 1203,
"ItemsUseNotSupported": 1204,
"HeroNoExist": 1300,
"HeroNoEnough": 1301,
"HeroMaxLv": 1302,
"HeroInitCreat": 1303,
"HeroColorErr": 1304,
"HeroSkillUpErr": 1305,
"HeroMaxResonate": 1306,
"HeroNoResonate": 1307,
"HeroNotNeedResonate": 1308,
"HeroNoEnergy": 1309,
"HeroCreate": 1310,
"HeroEquipUpdate": 1311,
"HeroMaxAwaken": 1312,
"HeroIsLock": 1313,
"HeroMaxCount": 1314,
"HeroCostTypeErr": 1315,
"HeroStarErr": 1316,
"HeroTypeErr": 1317,
"HeroExpTypeErr": 1318,
"HeroAddMaxExp": 1319,
"HeroStarLvErr": 1320,
"HeroMaxStarLv": 1321,
"DrawCardTypeNotFound": 1322,
"HeroMaxSkillLv": 1323,
"HeroAlreadyKongFuStatus": 1324,
"EquipmentOnFoundEquipment": 1400,
"EquipmentLvlimitReached": 1401,
"EquipmentIsWorn": 1402,
"EquipmentNoCanSell": 1403,
"MainlineNotFindChapter": 1500,
"MainlineIDFailed": 1501,
"MainlineNotFound": 1502,
"MainlinePreNotFound": 1503,
"MainlineRepeatReward": 1504,
"MainlineCompleteReward": 1505,
"TaskInit": 1600,
"TaskReset": 1601,
"TaskHandle": 1602,
"TaskReceived": 1603,
"TaskActiveInit": 1604,
"TaskActiveNofound": 1605,
"TaskActiveNoenough": 1606,
"TaskNoFinished": 1607,
"TaskFinished": 1608,
"TaskTagEmpty": 1609,
"TaskIdEmpty": 1610,
"TaskNotFound": 1611,
"ShopGoodsIsSoldOut": 1700,
"ShopNoSurplusRefreshNum": 1701,
"MailErr": 1800,
"PagodaNotFound": 1900,
"PagodaLevlErr": 1901,
"PagodaGetRewardErr": 1902,
"PagodaConditionErr": 1903,
"MartialhallNotUnlocked": 2000,
"MartialhallInUse": 2001,
"MartialhallUnlocked": 2002,
"MartialhallNoUnlocked": 2003,
"GourmetMoreOrderTime": 2101,
"GourmetSkillMaxLv": 2102,
"RtaskFinished": 2201,
"RtaskUnFinished": 2202,
"RtaskNoRtask": 2203,
"RtaskRewarded": 2204,
"RtaskPreNoFinish": 2205,
"RtaskCondiNoReach": 2206,
"RtaskNoLastOne": 2207,
"VikingLvErr": 2301,
"VikingBoosType": 2302,
"VikingBuyMaxCount": 2303,
"MoonfantasyHasExpired": 2401,
"MoonfantasyJoinUp": 2402,
"MoonfantasyDareUp": 2403,
"MoonfantasyBattleNoEnd": 2404,
"MoonfantasyBattleNoWin": 2405,
"BattleNoFoundRecord": 2501,
"Success": 0,
"NoFindService": 10,
"NoFindServiceHandleFunc": 11,
"RpcFuncExecutionError": 12,
"CacheReadError": 13,
"SqlExecutionError": 14,
"ReqParameterError": 15,
"SignError": 16,
"InsufficientPermissions": 17,
"NoLogin": 18,
"UserSessionNobeing": 19,
"StateInvalid": 20,
"DBError": 21,
"SystemError": 22,
"DecodeError": 23,
"TimestampTimeout": 24,
"PbError": 25,
"AgentUidEmpty": 26,
"Exception": 100,
"Unknown": 101,
"ResNoEnough": 102,
"ConfigurationException": 103,
"ConfigNoFound": 104,
"SecKeyInvalid": 1000,
"SecKey": 1001,
"BindUser": 1002,
"GoldNoEnough": 1003,
"DiamondNoEnough": 1004,
"RoleCreated": 1005,
"UserNickNameExist": 1006,
"VeriCodeNoValid": 1007,
"VeriCodeExpired": 1008,
"UserResetData": 1009,
"UserModiNameCount": 1010,
"UserNickNameEmpty": 1011,
"UserExpandNull": 1012,
"FriendNotSelf": 1100,
"FriendSelfMax": 1101,
"FriendTargetMax": 1102,
"FriendSelfNoData": 1103,
"FriendTargetNoData": 1104,
"FriendYet": 1105,
"FriendApplyYet": 1106,
"FriendSelfBlackYet": 1107,
"FriendTargetBlackYet": 1108,
"FriendApplyError": 1109,
"FriendBlackMax": 1110,
"FriendSearchNameEmpty": 1111,
"FriendZaned": 1112,
"FriendZanreceived": 1113,
"FriendZanSelf": 1114,
"FriendPointLimit": 1115,
"ItemsNoEnough": 1200,
"ItemsNoFoundGird": 1201,
"ItemsGridNumUpper": 1202,
"ItemsGirdAmountUpper": 1203,
"ItemsUseNotSupported": 1204,
"HeroNoExist": 1300,
"HeroNoEnough": 1301,
"HeroMaxLv": 1302,
"HeroInitCreat": 1303,
"HeroColorErr": 1304,
"HeroSkillUpErr": 1305,
"HeroMaxResonate": 1306,
"HeroNoResonate": 1307,
"HeroNotNeedResonate": 1308,
"HeroNoEnergy": 1309,
"HeroCreate": 1310,
"HeroEquipUpdate": 1311,
"HeroMaxAwaken": 1312,
"HeroIsLock": 1313,
"HeroMaxCount": 1314,
"HeroCostTypeErr": 1315,
"HeroStarErr": 1316,
"HeroTypeErr": 1317,
"HeroExpTypeErr": 1318,
"HeroAddMaxExp": 1319,
"HeroStarLvErr": 1320,
"HeroMaxStarLv": 1321,
"DrawCardTypeNotFound": 1322,
"HeroMaxSkillLv": 1323,
"HeroAlreadyKongFuStatus": 1324,
"EquipmentOnFoundEquipment": 1400,
"EquipmentLvlimitReached": 1401,
"EquipmentIsWorn": 1402,
"EquipmentNoCanSell": 1403,
"MainlineNotFindChapter": 1500,
"MainlineIDFailed": 1501,
"MainlineNotFound": 1502,
"MainlinePreNotFound": 1503,
"MainlineRepeatReward": 1504,
"MainlineCompleteReward": 1505,
"TaskInit": 1600,
"TaskReset": 1601,
"TaskHandle": 1602,
"TaskReceived": 1603,
"TaskActiveInit": 1604,
"TaskActiveNofound": 1605,
"TaskActiveNoenough": 1606,
"TaskNoFinished": 1607,
"TaskFinished": 1608,
"TaskTagEmpty": 1609,
"TaskIdEmpty": 1610,
"TaskNotFound": 1611,
"ShopGoodsIsSoldOut": 1700,
"ShopNoSurplusRefreshNum": 1701,
"MailErr": 1800,
"PagodaNotFound": 1900,
"PagodaLevlErr": 1901,
"PagodaGetRewardErr": 1902,
"PagodaConditionErr": 1903,
"MartialhallNotUnlocked": 2000,
"MartialhallInUse": 2001,
"MartialhallUnlocked": 2002,
"MartialhallNoUnlocked": 2003,
"GourmetMoreOrderTime": 2101,
"GourmetSkillMaxLv": 2102,
"RtaskFinished": 2201,
"RtaskUnFinished": 2202,
"RtaskNoRtask": 2203,
"RtaskRewarded": 2204,
"RtaskPreNoFinish": 2205,
"RtaskCondiNoReach": 2206,
"RtaskNoLastOne": 2207,
"VikingLvErr": 2301,
"VikingBoosType": 2302,
"VikingBuyMaxCount": 2303,
"MoonfantasyHasExpired": 2401,
"MoonfantasyJoinUp": 2402,
"MoonfantasyDareUp": 2403,
"MoonfantasyBattleNoEnd": 2404,
"MoonfantasyBattleNoWin": 2405,
"BattleNoFoundRecord": 2501,
"LinestoryTaskNoFinished": 2601,
"LinestorySubTaskNoFinished": 2602,
"LinestoryTaskDisabledEnter": 2603,
}
)
@ -478,7 +487,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, 0xd3, 0x16, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
0x6f, 0x2a, 0xb3, 0x17, 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,
@ -659,7 +668,13 @@ var file_errorcode_proto_rawDesc = []byte{
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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
0x63, 0x6f, 0x72, 0x64, 0x10, 0xc5, 0x13, 0x12, 0x1c, 0x0a, 0x17, 0x4c, 0x69, 0x6e, 0x65, 0x73,
0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68,
0x65, 0x64, 0x10, 0xa9, 0x14, 0x12, 0x1f, 0x0a, 0x1a, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f,
0x72, 0x79, 0x53, 0x75, 0x62, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}

251
pb/linestory_db.pb.go Normal file
View File

@ -0,0 +1,251 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: linestory/linestory_db.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type TaskNode struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Status int32 `protobuf:"varint,1,opt,name=status,proto3" json:"status" bson:"status"` //状态 0未做
// 1进行中(子任务没有全部完成) 2已做 3禁止进入
SubtaskIds []int32 `protobuf:"varint,2,rep,packed,name=subtaskIds,proto3" json:"subtaskIds" bson:"subtasks"` //子任务
}
func (x *TaskNode) Reset() {
*x = TaskNode{}
if protoimpl.UnsafeEnabled {
mi := &file_linestory_linestory_db_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TaskNode) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TaskNode) ProtoMessage() {}
func (x *TaskNode) ProtoReflect() protoreflect.Message {
mi := &file_linestory_linestory_db_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TaskNode.ProtoReflect.Descriptor instead.
func (*TaskNode) Descriptor() ([]byte, []int) {
return file_linestory_linestory_db_proto_rawDescGZIP(), []int{0}
}
func (x *TaskNode) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
func (x *TaskNode) GetSubtaskIds() []int32 {
if x != nil {
return x.SubtaskIds
}
return nil
}
type DBLinestory struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
JqId int32 `protobuf:"varint,3,opt,name=jqId,proto3" json:"jqId" bson:"jqId"` //剧情ID
Tasks map[int32]*TaskNode `protobuf:"bytes,4,rep,name=tasks,proto3" json:"tasks" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" bson:"tasks"` //任务
}
func (x *DBLinestory) Reset() {
*x = DBLinestory{}
if protoimpl.UnsafeEnabled {
mi := &file_linestory_linestory_db_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DBLinestory) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DBLinestory) ProtoMessage() {}
func (x *DBLinestory) ProtoReflect() protoreflect.Message {
mi := &file_linestory_linestory_db_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DBLinestory.ProtoReflect.Descriptor instead.
func (*DBLinestory) Descriptor() ([]byte, []int) {
return file_linestory_linestory_db_proto_rawDescGZIP(), []int{1}
}
func (x *DBLinestory) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *DBLinestory) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *DBLinestory) GetJqId() int32 {
if x != nil {
return x.JqId
}
return 0
}
func (x *DBLinestory) GetTasks() map[int32]*TaskNode {
if x != nil {
return x.Tasks
}
return nil
}
var File_linestory_linestory_db_proto protoreflect.FileDescriptor
var file_linestory_linestory_db_proto_rawDesc = []byte{
0x0a, 0x1c, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x6c, 0x69, 0x6e, 0x65,
0x73, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x42,
0x0a, 0x08, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74,
0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74,
0x75, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73,
0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x75, 0x62, 0x74, 0x61, 0x73, 0x6b, 0x49,
0x64, 0x73, 0x22, 0xb7, 0x01, 0x0a, 0x0b, 0x44, 0x42, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f,
0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6a, 0x71, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01,
0x28, 0x05, 0x52, 0x04, 0x6a, 0x71, 0x49, 0x64, 0x12, 0x2d, 0x0a, 0x05, 0x74, 0x61, 0x73, 0x6b,
0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x44, 0x42, 0x4c, 0x69, 0x6e, 0x65,
0x73, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x52, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x1a, 0x43, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x73,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x64,
0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04,
0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_linestory_linestory_db_proto_rawDescOnce sync.Once
file_linestory_linestory_db_proto_rawDescData = file_linestory_linestory_db_proto_rawDesc
)
func file_linestory_linestory_db_proto_rawDescGZIP() []byte {
file_linestory_linestory_db_proto_rawDescOnce.Do(func() {
file_linestory_linestory_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_linestory_linestory_db_proto_rawDescData)
})
return file_linestory_linestory_db_proto_rawDescData
}
var file_linestory_linestory_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_linestory_linestory_db_proto_goTypes = []interface{}{
(*TaskNode)(nil), // 0: TaskNode
(*DBLinestory)(nil), // 1: DBLinestory
nil, // 2: DBLinestory.TasksEntry
}
var file_linestory_linestory_db_proto_depIdxs = []int32{
2, // 0: DBLinestory.tasks:type_name -> DBLinestory.TasksEntry
0, // 1: DBLinestory.TasksEntry.value:type_name -> TaskNode
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_linestory_linestory_db_proto_init() }
func file_linestory_linestory_db_proto_init() {
if File_linestory_linestory_db_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_linestory_linestory_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TaskNode); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_linestory_linestory_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBLinestory); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_linestory_linestory_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_linestory_linestory_db_proto_goTypes,
DependencyIndexes: file_linestory_linestory_db_proto_depIdxs,
MessageInfos: file_linestory_linestory_db_proto_msgTypes,
}.Build()
File_linestory_linestory_db_proto = out.File
file_linestory_linestory_db_proto_rawDesc = nil
file_linestory_linestory_db_proto_goTypes = nil
file_linestory_linestory_db_proto_depIdxs = nil
}

500
pb/linestory_msg.pb.go Normal file
View File

@ -0,0 +1,500 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: linestory/linestory_msg.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// 剧情开始
type LinestoryStartReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
JqId int32 `protobuf:"varint,1,opt,name=jqId,proto3" json:"jqId"` //剧情ID
}
func (x *LinestoryStartReq) Reset() {
*x = LinestoryStartReq{}
if protoimpl.UnsafeEnabled {
mi := &file_linestory_linestory_msg_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LinestoryStartReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LinestoryStartReq) ProtoMessage() {}
func (x *LinestoryStartReq) ProtoReflect() protoreflect.Message {
mi := &file_linestory_linestory_msg_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LinestoryStartReq.ProtoReflect.Descriptor instead.
func (*LinestoryStartReq) Descriptor() ([]byte, []int) {
return file_linestory_linestory_msg_proto_rawDescGZIP(), []int{0}
}
func (x *LinestoryStartReq) GetJqId() int32 {
if x != nil {
return x.JqId
}
return 0
}
type LinestoryStartResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
JqId int32 `protobuf:"varint,1,opt,name=jqId,proto3" json:"jqId"`
TaskIds []int32 `protobuf:"varint,2,rep,packed,name=taskIds,proto3" json:"taskIds"` //已完成的任务ID
}
func (x *LinestoryStartResp) Reset() {
*x = LinestoryStartResp{}
if protoimpl.UnsafeEnabled {
mi := &file_linestory_linestory_msg_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LinestoryStartResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LinestoryStartResp) ProtoMessage() {}
func (x *LinestoryStartResp) ProtoReflect() protoreflect.Message {
mi := &file_linestory_linestory_msg_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LinestoryStartResp.ProtoReflect.Descriptor instead.
func (*LinestoryStartResp) Descriptor() ([]byte, []int) {
return file_linestory_linestory_msg_proto_rawDescGZIP(), []int{1}
}
func (x *LinestoryStartResp) GetJqId() int32 {
if x != nil {
return x.JqId
}
return 0
}
func (x *LinestoryStartResp) GetTaskIds() []int32 {
if x != nil {
return x.TaskIds
}
return nil
}
// 做任务
type LinestoryDotaskReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId"` //任务ID
SubtaskId int32 `protobuf:"varint,2,opt,name=subtaskId,proto3" json:"subtaskId"` //子任务ID
}
func (x *LinestoryDotaskReq) Reset() {
*x = LinestoryDotaskReq{}
if protoimpl.UnsafeEnabled {
mi := &file_linestory_linestory_msg_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LinestoryDotaskReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LinestoryDotaskReq) ProtoMessage() {}
func (x *LinestoryDotaskReq) ProtoReflect() protoreflect.Message {
mi := &file_linestory_linestory_msg_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LinestoryDotaskReq.ProtoReflect.Descriptor instead.
func (*LinestoryDotaskReq) Descriptor() ([]byte, []int) {
return file_linestory_linestory_msg_proto_rawDescGZIP(), []int{2}
}
func (x *LinestoryDotaskReq) GetTaskId() int32 {
if x != nil {
return x.TaskId
}
return 0
}
func (x *LinestoryDotaskReq) GetSubtaskId() int32 {
if x != nil {
return x.SubtaskId
}
return 0
}
type LinestoryDotaskResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId"` //任务ID
SubtaskId int32 `protobuf:"varint,2,opt,name=subtaskId,proto3" json:"subtaskId"` //子任务ID
ResetTaskId int32 `protobuf:"varint,3,opt,name=resetTaskId,proto3" json:"resetTaskId"` //重置任务起始ID
}
func (x *LinestoryDotaskResp) Reset() {
*x = LinestoryDotaskResp{}
if protoimpl.UnsafeEnabled {
mi := &file_linestory_linestory_msg_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LinestoryDotaskResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LinestoryDotaskResp) ProtoMessage() {}
func (x *LinestoryDotaskResp) ProtoReflect() protoreflect.Message {
mi := &file_linestory_linestory_msg_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LinestoryDotaskResp.ProtoReflect.Descriptor instead.
func (*LinestoryDotaskResp) Descriptor() ([]byte, []int) {
return file_linestory_linestory_msg_proto_rawDescGZIP(), []int{3}
}
func (x *LinestoryDotaskResp) GetTaskId() int32 {
if x != nil {
return x.TaskId
}
return 0
}
func (x *LinestoryDotaskResp) GetSubtaskId() int32 {
if x != nil {
return x.SubtaskId
}
return 0
}
func (x *LinestoryDotaskResp) GetResetTaskId() int32 {
if x != nil {
return x.ResetTaskId
}
return 0
}
// 做子任务
type LinestoryDosubtaskReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SubtaskId int32 `protobuf:"varint,1,opt,name=subtaskId,proto3" json:"subtaskId"` //子任务ID
}
func (x *LinestoryDosubtaskReq) Reset() {
*x = LinestoryDosubtaskReq{}
if protoimpl.UnsafeEnabled {
mi := &file_linestory_linestory_msg_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LinestoryDosubtaskReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LinestoryDosubtaskReq) ProtoMessage() {}
func (x *LinestoryDosubtaskReq) ProtoReflect() protoreflect.Message {
mi := &file_linestory_linestory_msg_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LinestoryDosubtaskReq.ProtoReflect.Descriptor instead.
func (*LinestoryDosubtaskReq) Descriptor() ([]byte, []int) {
return file_linestory_linestory_msg_proto_rawDescGZIP(), []int{4}
}
func (x *LinestoryDosubtaskReq) GetSubtaskId() int32 {
if x != nil {
return x.SubtaskId
}
return 0
}
type LinestoryDosubtaskResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SubtaskId int32 `protobuf:"varint,1,opt,name=subtaskId,proto3" json:"subtaskId"` //子任务ID
}
func (x *LinestoryDosubtaskResp) Reset() {
*x = LinestoryDosubtaskResp{}
if protoimpl.UnsafeEnabled {
mi := &file_linestory_linestory_msg_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LinestoryDosubtaskResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LinestoryDosubtaskResp) ProtoMessage() {}
func (x *LinestoryDosubtaskResp) ProtoReflect() protoreflect.Message {
mi := &file_linestory_linestory_msg_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LinestoryDosubtaskResp.ProtoReflect.Descriptor instead.
func (*LinestoryDosubtaskResp) Descriptor() ([]byte, []int) {
return file_linestory_linestory_msg_proto_rawDescGZIP(), []int{5}
}
func (x *LinestoryDosubtaskResp) GetSubtaskId() int32 {
if x != nil {
return x.SubtaskId
}
return 0
}
var File_linestory_linestory_msg_proto protoreflect.FileDescriptor
var file_linestory_linestory_msg_proto_rawDesc = []byte{
0x0a, 0x1d, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x6c, 0x69, 0x6e, 0x65,
0x73, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0x27, 0x0a, 0x11, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x74, 0x61, 0x72,
0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6a, 0x71, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x04, 0x6a, 0x71, 0x49, 0x64, 0x22, 0x42, 0x0a, 0x12, 0x4c, 0x69, 0x6e, 0x65,
0x73, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12,
0x0a, 0x04, 0x6a, 0x71, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x6a, 0x71,
0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20,
0x03, 0x28, 0x05, 0x52, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x22, 0x4a, 0x0a, 0x12,
0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x6f, 0x74, 0x61, 0x73, 0x6b, 0x52,
0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x75,
0x62, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73,
0x75, 0x62, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x6d, 0x0a, 0x13, 0x4c, 0x69, 0x6e, 0x65,
0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x6f, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12,
0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x74, 0x61,
0x73, 0x6b, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x75, 0x62, 0x74,
0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x65, 0x74, 0x54, 0x61,
0x73, 0x6b, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x72, 0x65, 0x73, 0x65,
0x74, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x35, 0x0a, 0x15, 0x4c, 0x69, 0x6e, 0x65, 0x73,
0x74, 0x6f, 0x72, 0x79, 0x44, 0x6f, 0x73, 0x75, 0x62, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71,
0x12, 0x1c, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x75, 0x62, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x36,
0x0a, 0x16, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x6f, 0x73, 0x75, 0x62,
0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x74,
0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x75, 0x62,
0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_linestory_linestory_msg_proto_rawDescOnce sync.Once
file_linestory_linestory_msg_proto_rawDescData = file_linestory_linestory_msg_proto_rawDesc
)
func file_linestory_linestory_msg_proto_rawDescGZIP() []byte {
file_linestory_linestory_msg_proto_rawDescOnce.Do(func() {
file_linestory_linestory_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_linestory_linestory_msg_proto_rawDescData)
})
return file_linestory_linestory_msg_proto_rawDescData
}
var file_linestory_linestory_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_linestory_linestory_msg_proto_goTypes = []interface{}{
(*LinestoryStartReq)(nil), // 0: LinestoryStartReq
(*LinestoryStartResp)(nil), // 1: LinestoryStartResp
(*LinestoryDotaskReq)(nil), // 2: LinestoryDotaskReq
(*LinestoryDotaskResp)(nil), // 3: LinestoryDotaskResp
(*LinestoryDosubtaskReq)(nil), // 4: LinestoryDosubtaskReq
(*LinestoryDosubtaskResp)(nil), // 5: LinestoryDosubtaskResp
}
var file_linestory_linestory_msg_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_linestory_linestory_msg_proto_init() }
func file_linestory_linestory_msg_proto_init() {
if File_linestory_linestory_msg_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_linestory_linestory_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LinestoryStartReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_linestory_linestory_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LinestoryStartResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_linestory_linestory_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LinestoryDotaskReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_linestory_linestory_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LinestoryDotaskResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_linestory_linestory_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LinestoryDosubtaskReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_linestory_linestory_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LinestoryDosubtaskResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_linestory_linestory_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_linestory_linestory_msg_proto_goTypes,
DependencyIndexes: file_linestory_linestory_msg_proto_depIdxs,
MessageInfos: file_linestory_linestory_msg_proto_msgTypes,
}.Build()
File_linestory_linestory_msg_proto = out.File
file_linestory_linestory_msg_proto_rawDesc = nil
file_linestory_linestory_msg_proto_goTypes = nil
file_linestory_linestory_msg_proto_depIdxs = nil
}

View File

@ -152,7 +152,9 @@ type RtaskData struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data map[int32]int32 `protobuf:"bytes,1,rep,name=data,proto3" json:"data" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"data"` // 当前任务值
Data map[int32]int32 `protobuf:"bytes,1,rep,name=data,proto3" json:"data" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"data"` // 当前任务值
Rtype int32 `protobuf:"varint,2,opt,name=rtype,proto3" json:"rtype" bson:"rtype"` // 任务类型
Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp"` //@go_tasg(`bson:"timestamp"`) 时间戳
}
func (x *RtaskData) Reset() {
@ -194,17 +196,29 @@ func (x *RtaskData) GetData() map[int32]int32 {
return nil
}
func (x *RtaskData) GetRtype() int32 {
if x != nil {
return x.Rtype
}
return 0
}
func (x *RtaskData) GetTimestamp() int64 {
if x != nil {
return x.Timestamp
}
return 0
}
// 玩家任务记录
type DBRtaskRecord struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
RType int32 `protobuf:"varint,3,opt,name=rType,proto3" json:"rType" bson:"rType"` //任务类型
Vals map[int32]*RtaskData `protobuf:"bytes,4,rep,name=vals,proto3" json:"vals" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" bson:"vals"` //任务记录值
Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp"` //@go_tasg(`bson:"timestamp"`) 时间戳
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
Vals map[int32]*RtaskData `protobuf:"bytes,3,rep,name=vals,proto3" json:"vals" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" bson:"vals"` //任务记录值
}
func (x *DBRtaskRecord) Reset() {
@ -253,13 +267,6 @@ func (x *DBRtaskRecord) GetUid() string {
return ""
}
func (x *DBRtaskRecord) GetRType() int32 {
if x != nil {
return x.RType
}
return 0
}
func (x *DBRtaskRecord) GetVals() map[int32]*RtaskData {
if x != nil {
return x.Vals
@ -267,13 +274,6 @@ func (x *DBRtaskRecord) GetVals() map[int32]*RtaskData {
return nil
}
func (x *DBRtaskRecord) GetTimestamp() int64 {
if x != nil {
return x.Timestamp
}
return 0
}
var File_rtask_rtask_db_proto protoreflect.FileDescriptor
var file_rtask_rtask_db_proto_rawDesc = []byte{
@ -295,29 +295,29 @@ var file_rtask_rtask_db_proto_rawDesc = []byte{
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x66, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64,
0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x6e, 0x0a, 0x09,
0x72, 0x74, 0x61, 0x73, 0x6b, 0x44, 0x61, 0x74, 0x61, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74,
0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x44,
0x61, 0x74, 0x61, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x64,
0x61, 0x74, 0x61, 0x1a, 0x37, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xa2, 0x01, 0x0a,
0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x44, 0x61, 0x74, 0x61, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61,
0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x72, 0x74, 0x61, 0x73, 0x6b,
0x44, 0x61, 0x74, 0x61, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04,
0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69,
0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74,
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x1a, 0x37, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38,
0x01, 0x22, 0xa4, 0x01, 0x0a, 0x0d, 0x44, 0x42, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63,
0x6f, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x2c, 0x0a, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x18, 0x03, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x44, 0x42, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63,
0x6f, 0x72, 0x64, 0x2e, 0x56, 0x61, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x76,
0x61, 0x6c, 0x73, 0x1a, 0x43, 0x0a, 0x09, 0x56, 0x61, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b,
0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xd8, 0x01, 0x0a,
0x0d, 0x44, 0x42, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x0e,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10,
0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64,
0x12, 0x14, 0x0a, 0x05, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
0x05, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x18, 0x04,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x44, 0x42, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65,
0x63, 0x6f, 0x72, 0x64, 0x2e, 0x56, 0x61, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04,
0x76, 0x61, 0x6c, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,
0x6d, 0x70, 0x1a, 0x43, 0x0a, 0x09, 0x56, 0x61, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12,
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65,
0x79, 0x12, 0x20, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x0a, 0x2e, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x65, 0x79, 0x12, 0x20, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x0a, 0x2e, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -512,6 +512,7 @@ type RtaskTestReq struct {
RtaskType int32 `protobuf:"varint,1,opt,name=rtaskType,proto3" json:"rtaskType"` //任务类型
Params []int32 `protobuf:"varint,2,rep,packed,name=params,proto3" json:"params"` //参数
CondiId int32 `protobuf:"varint,3,opt,name=condiId,proto3" json:"condiId"` //条件ID
}
func (x *RtaskTestReq) Reset() {
@ -560,6 +561,13 @@ func (x *RtaskTestReq) GetParams() []int32 {
return nil
}
func (x *RtaskTestReq) GetCondiId() int32 {
if x != nil {
return x.CondiId
}
return 0
}
type RtaskTestResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -650,14 +658,16 @@ var file_rtask_rtask_msg_proto_rawDesc = []byte{
0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b,
0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64,
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62,
0x49, 0x64, 0x22, 0x44, 0x0a, 0x0c, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x65, 0x73, 0x74, 0x52,
0x49, 0x64, 0x22, 0x5e, 0x0a, 0x0c, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x65, 0x73, 0x74, 0x52,
0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65,
0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05,
0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x23, 0x0a, 0x0d, 0x52, 0x74, 0x61, 0x73,
0x6b, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x61,
0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x42, 0x06, 0x5a,
0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x64,
0x69, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x64, 0x69,
0x49, 0x64, 0x22, 0x23, 0x0a, 0x0d, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x65, 0x73, 0x74, 0x52,
0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28,
0x08, 0x52, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -13,6 +13,7 @@ import (
"go_dreamfactory/modules/hero"
"go_dreamfactory/modules/hunting"
"go_dreamfactory/modules/items"
"go_dreamfactory/modules/linestory"
"go_dreamfactory/modules/mail"
"go_dreamfactory/modules/mainline"
"go_dreamfactory/modules/martialhall"
@ -76,6 +77,7 @@ func main() {
moonfantasy.NewModule(),
hunting.NewModule(),
battle.NewModule(),
linestory.NewModule(),
)
}

View File

@ -12,11 +12,10 @@ import "errors"
type GameLineStoryStageTaskData struct {
Id int32
PosTId int32
PreTId int32
NextTId int32
Cond []int32
Reward []*Gameatn
Jump string
}
const TypeId_GameLineStoryStageTaskData = 884678024
@ -27,7 +26,7 @@ func (*GameLineStoryStageTaskData) GetTypeId() int32 {
func (_v *GameLineStoryStageTaskData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["posTId"].(float64); !_ok_ { err = errors.New("posTId error"); return }; _v.PosTId = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["preTId"].(float64); !_ok_ { err = errors.New("preTId error"); return }; _v.PreTId = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["nextTId"].(float64); !_ok_ { err = errors.New("nextTId error"); return }; _v.NextTId = int32(_tempNum_) }
{
var _arr_ []interface{}
@ -57,7 +56,6 @@ func (_v *GameLineStoryStageTaskData)Deserialize(_buf map[string]interface{}) (e
}
}
{ var _ok_ bool; if _v.Jump, _ok_ = _buf["jump"].(string); !_ok_ { err = errors.New("jump error"); return } }
return
}

View File

@ -17,6 +17,7 @@ type GameLineStoryTaskData struct {
Reward []*Gameatn
Finish int32
Ending int32
Resetto int32
}
const TypeId_GameLineStoryTaskData = -2080476076
@ -58,6 +59,7 @@ func (_v *GameLineStoryTaskData)Deserialize(_buf map[string]interface{}) (err er
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["finish"].(float64); !_ok_ { err = errors.New("finish error"); return }; _v.Finish = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["ending"].(float64); !_ok_ { err = errors.New("ending error"); return }; _v.Ending = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["resetto"].(float64); !_ok_ { err = errors.New("resetto error"); return }; _v.Resetto = int32(_tempNum_) }
return
}

View File

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
type GameVikingBossSkill struct {
_dataMap map[int32]*GameVikingBossSkillData
_dataList []*GameVikingBossSkillData
}
func NewGameVikingBossSkill(_buf []map[string]interface{}) (*GameVikingBossSkill, error) {
_dataList := make([]*GameVikingBossSkillData, 0, len(_buf))
dataMap := make(map[int32]*GameVikingBossSkillData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameVikingBossSkillData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Type] = _v
}
}
return &GameVikingBossSkill{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameVikingBossSkill) GetDataMap() map[int32]*GameVikingBossSkillData {
return table._dataMap
}
func (table *GameVikingBossSkill) GetDataList() []*GameVikingBossSkillData {
return table._dataList
}
func (table *GameVikingBossSkill) Get(key int32) *GameVikingBossSkillData {
return table._dataMap[key]
}

View File

@ -0,0 +1,56 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
import "errors"
type GameVikingBossSkillData struct {
Type int32
Name string
Introduce string
Icon string
Guardskill []int32
}
const TypeId_GameVikingBossSkillData = -1331434488
func (*GameVikingBossSkillData) GetTypeId() int32 {
return -1331434488
}
func (_v *GameVikingBossSkillData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) }
{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 __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["introduce"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Introduce error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Introduce, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; if _v.Icon, _ok_ = _buf["icon"].(string); !_ok_ { err = errors.New("icon error"); return } }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["guardskill"].([]interface{}); !_ok_ { err = errors.New("guardskill error"); return }
_v.Guardskill = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ int32
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
_v.Guardskill = append(_v.Guardskill, _list_v_)
}
}
return
}
func DeserializeGameVikingBossSkillData(_buf map[string]interface{}) (*GameVikingBossSkillData, error) {
v := &GameVikingBossSkillData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View File

@ -58,7 +58,6 @@ type Tables struct {
Facemod *GameFacemod
Msgdistrib *GameMsgdistrib
Opencond *GameOpencond
Stroy *GameStroy
Pagoda *GamePagoda
PagodaTaskReward *GamePagodaTaskReward
PagodaSeasonReward *GamePagodaSeasonReward
@ -87,6 +86,7 @@ type Tables struct {
LineStoryChapter *GameLineStoryChapter
LineStoryTask *GameLineStoryTask
LineStoryStageTask *GameLineStoryStageTask
VikingBossSkill *GameVikingBossSkill
}
func NewTables(loader JsonLoader) (*Tables, error) {
@ -376,12 +376,6 @@ func NewTables(loader JsonLoader) (*Tables, error) {
if tables.Opencond, err = NewGameOpencond(buf) ; err != nil {
return nil, err
}
if buf, err = loader("game_stroy") ; err != nil {
return nil, err
}
if tables.Stroy, err = NewGameStroy(buf) ; err != nil {
return nil, err
}
if buf, err = loader("game_pagoda") ; err != nil {
return nil, err
}
@ -550,5 +544,11 @@ func NewTables(loader JsonLoader) (*Tables, error) {
if tables.LineStoryStageTask, err = NewGameLineStoryStageTask(buf) ; err != nil {
return nil, err
}
if buf, err = loader("game_vikingbossskill") ; err != nil {
return nil, err
}
if tables.VikingBossSkill, err = NewGameVikingBossSkill(buf) ; err != nil {
return nil, err
}
return tables, nil
}

View File

@ -15,7 +15,8 @@ type GameMonsterData struct {
HeroId string
Name string
Star int32
Equip []int32
Equip2 int32
Equip4 int32
}
const TypeId_GameMonsterData = 31965864
@ -29,20 +30,8 @@ func (_v *GameMonsterData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; if _v.HeroId, _ok_ = _buf["hero_id"].(string); !_ok_ { err = errors.New("hero_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["star"].(float64); !_ok_ { err = errors.New("star error"); return }; _v.Star = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["equip"].([]interface{}); !_ok_ { err = errors.New("equip error"); return }
_v.Equip = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ int32
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
_v.Equip = append(_v.Equip, _list_v_)
}
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["equip2"].(float64); !_ok_ { err = errors.New("equip2 error"); return }; _v.Equip2 = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["equip4"].(float64); !_ok_ { err = errors.New("equip4 error"); return }; _v.Equip4 = int32(_tempNum_) }
return
}

View File

@ -13,7 +13,7 @@ import "errors"
type GameOpencondData struct {
Id string
Name string
Main string
Main int32
Optional string
Wkqbx int32
Kqbx int32
@ -31,7 +31,7 @@ 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; if _v.Main, _ok_ = _buf["main"].(string); !_ok_ { err = errors.New("main 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 _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_) }

View File

@ -1,42 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
type GameSkill struct {
_dataMap map[int32]*GameSkillData
_dataList []*GameSkillData
}
func NewGameSkill(_buf []map[string]interface{}) (*GameSkill, error) {
_dataList := make([]*GameSkillData, 0, len(_buf))
dataMap := make(map[int32]*GameSkillData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameSkillData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameSkill{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameSkill) GetDataMap() map[int32]*GameSkillData {
return table._dataMap
}
func (table *GameSkill) GetDataList() []*GameSkillData {
return table._dataList
}
func (table *GameSkill) Get(key int32) *GameSkillData {
return table._dataMap[key]
}

View File

@ -1,107 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
import "errors"
type GameSkillData struct {
Id int32
Name string
Ico string
Act string
Type int32
MaxLV int32
CD []int32
Target int32
ChildSkill []*GameChildSkills
Desc []string
Buffid []int32
}
const TypeId_GameSkillData = -598580577
func (*GameSkillData) GetTypeId() int32 {
return -598580577
}
func (_v *GameSkillData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Id"].(float64); !_ok_ { err = errors.New("Id error"); return }; _v.Id = int32(_tempNum_) }
{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; if _v.Ico, _ok_ = _buf["ico"].(string); !_ok_ { err = errors.New("ico error"); return } }
{ var _ok_ bool; if _v.Act, _ok_ = _buf["act"].(string); !_ok_ { err = errors.New("act error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Type"].(float64); !_ok_ { err = errors.New("Type error"); return }; _v.Type = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["MaxLV"].(float64); !_ok_ { err = errors.New("MaxLV error"); return }; _v.MaxLV = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["CD"].([]interface{}); !_ok_ { err = errors.New("CD error"); return }
_v.CD = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ int32
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
_v.CD = append(_v.CD, _list_v_)
}
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Target"].(float64); !_ok_ { err = errors.New("Target error"); return }; _v.Target = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["ChildSkill"].([]interface{}); !_ok_ { err = errors.New("ChildSkill error"); return }
_v.ChildSkill = make([]*GameChildSkills, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ *GameChildSkills
{ 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 = DeserializeGameChildSkills(_x_); err != nil { return } }
_v.ChildSkill = append(_v.ChildSkill, _list_v_)
}
}
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["Desc"].([]interface{}); !_ok_ { err = errors.New("Desc error"); return }
_v.Desc = make([]string, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ string
{ if _list_v_, _ok_ = _e_.(string); !_ok_ { err = errors.New("_list_v_ error"); return } }
_v.Desc = append(_v.Desc, _list_v_)
}
}
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["buffid"].([]interface{}); !_ok_ { err = errors.New("buffid error"); return }
_v.Buffid = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ int32
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
_v.Buffid = append(_v.Buffid, _list_v_)
}
}
return
}
func DeserializeGameSkillData(_buf map[string]interface{}) (*GameSkillData, error) {
v := &GameSkillData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View File

@ -1,42 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
type GameStroy struct {
_dataMap map[int32]*GameStroyData
_dataList []*GameStroyData
}
func NewGameStroy(_buf []map[string]interface{}) (*GameStroy, error) {
_dataList := make([]*GameStroyData, 0, len(_buf))
dataMap := make(map[int32]*GameStroyData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameStroyData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameStroy{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameStroy) GetDataMap() map[int32]*GameStroyData {
return table._dataMap
}
func (table *GameStroy) GetDataList() []*GameStroyData {
return table._dataList
}
func (table *GameStroy) Get(key int32) *GameStroyData {
return table._dataMap[key]
}

View File

@ -1,122 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
import "errors"
import "bright/serialization"
type GameStroyData struct {
Id int32
Groupid int32
Before int32
Next int32
Type int32
Bg string
Place int32
Speak string
Listen string
Emoji string
Des string
Modelstatetarget string
Modelstate int32
Modelaction string
State string
Chose []int32
Turn int32
Show int32
Move string
Action string
Sound string
Position serialization.Vector3
Revolve serialization.Vector3
Size serialization.Vector3
Perf string
Cg string
Skip bool
}
const TypeId_GameStroyData = 1697302313
func (*GameStroyData) GetTypeId() int32 {
return 1697302313
}
func (_v *GameStroyData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["groupid"].(float64); !_ok_ { err = errors.New("groupid error"); return }; _v.Groupid = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["before"].(float64); !_ok_ { err = errors.New("before error"); return }; _v.Before = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["next"].(float64); !_ok_ { err = errors.New("next error"); return }; _v.Next = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) }
{ var _ok_ bool; if _v.Bg, _ok_ = _buf["bg"].(string); !_ok_ { err = errors.New("bg error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["place"].(float64); !_ok_ { err = errors.New("place error"); return }; _v.Place = int32(_tempNum_) }
{ var _ok_ bool; if _v.Speak, _ok_ = _buf["speak"].(string); !_ok_ { err = errors.New("speak error"); return } }
{ var _ok_ bool; if _v.Listen, _ok_ = _buf["listen"].(string); !_ok_ { err = errors.New("listen error"); return } }
{ var _ok_ bool; if _v.Emoji, _ok_ = _buf["emoji"].(string); !_ok_ { err = errors.New("emoji error"); return } }
{ var _ok_ bool; if _v.Des, _ok_ = _buf["des"].(string); !_ok_ { err = errors.New("des error"); return } }
{ var _ok_ bool; if _v.Modelstatetarget, _ok_ = _buf["modelstatetarget"].(string); !_ok_ { err = errors.New("modelstatetarget error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["modelstate"].(float64); !_ok_ { err = errors.New("modelstate error"); return }; _v.Modelstate = int32(_tempNum_) }
{ var _ok_ bool; if _v.Modelaction, _ok_ = _buf["modelaction"].(string); !_ok_ { err = errors.New("modelaction error"); return } }
{ var _ok_ bool; if _v.State, _ok_ = _buf["state"].(string); !_ok_ { err = errors.New("state error"); return } }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["chose"].([]interface{}); !_ok_ { err = errors.New("chose error"); return }
_v.Chose = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ int32
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
_v.Chose = append(_v.Chose, _list_v_)
}
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["turn"].(float64); !_ok_ { err = errors.New("turn error"); return }; _v.Turn = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["show"].(float64); !_ok_ { err = errors.New("show error"); return }; _v.Show = int32(_tempNum_) }
{ var _ok_ bool; if _v.Move, _ok_ = _buf["move"].(string); !_ok_ { err = errors.New("move error"); return } }
{ var _ok_ bool; if _v.Action, _ok_ = _buf["action"].(string); !_ok_ { err = errors.New("action error"); return } }
{ var _ok_ bool; if _v.Sound, _ok_ = _buf["sound"].(string); !_ok_ { err = errors.New("sound error"); return } }
{ var _ok_ bool; var _v_ map[string]interface{}; if _v_, _ok_ = _buf["position"].(map[string]interface{}); !_ok_ { err = errors.New("position error"); return }
var _x_, _y_, _z_ float32;
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _v_["x"].(float64); !_ok_ { err = errors.New("x error"); return }; _x_ = float32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _v_["y"].(float64); !_ok_ { err = errors.New("y error"); return }; _y_ = float32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _v_["z"].(float64); !_ok_ { err = errors.New("z error"); return }; _z_ = float32(_tempNum_) }
_v.Position = serialization.NewVector3(_x_, _y_, _z_)
}
{ var _ok_ bool; var _v_ map[string]interface{}; if _v_, _ok_ = _buf["revolve"].(map[string]interface{}); !_ok_ { err = errors.New("revolve error"); return }
var _x_, _y_, _z_ float32;
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _v_["x"].(float64); !_ok_ { err = errors.New("x error"); return }; _x_ = float32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _v_["y"].(float64); !_ok_ { err = errors.New("y error"); return }; _y_ = float32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _v_["z"].(float64); !_ok_ { err = errors.New("z error"); return }; _z_ = float32(_tempNum_) }
_v.Revolve = serialization.NewVector3(_x_, _y_, _z_)
}
{ var _ok_ bool; var _v_ map[string]interface{}; if _v_, _ok_ = _buf["size"].(map[string]interface{}); !_ok_ { err = errors.New("size error"); return }
var _x_, _y_, _z_ float32;
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _v_["x"].(float64); !_ok_ { err = errors.New("x error"); return }; _x_ = float32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _v_["y"].(float64); !_ok_ { err = errors.New("y error"); return }; _y_ = float32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _v_["z"].(float64); !_ok_ { err = errors.New("z error"); return }; _z_ = float32(_tempNum_) }
_v.Size = serialization.NewVector3(_x_, _y_, _z_)
}
{ var _ok_ bool; if _v.Perf, _ok_ = _buf["perf"].(string); !_ok_ { err = errors.New("perf error"); return } }
{ var _ok_ bool; if _v.Cg, _ok_ = _buf["cg"].(string); !_ok_ { err = errors.New("cg error"); return } }
{ var _ok_ bool; if _v.Skip, _ok_ = _buf["skip"].(bool); !_ok_ { err = errors.New("skip error"); return } }
return
}
func DeserializeGameStroyData(_buf map[string]interface{}) (*GameStroyData, error) {
v := &GameStroyData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View File

@ -28,3 +28,9 @@ func GetZeroTime(curTime int64) int64 {
return startTime.Unix() + 86400 //3600*24
}
func IsYestoday(timestamp int64) bool {
tt := time.Unix(timestamp, 0)
yesTime := time.Now().AddDate(0, 0, -1)
return tt.Year() == yesTime.Year() && tt.Month() == yesTime.Month() && tt.Day() == yesTime.Day()
}

View File

@ -5,6 +5,8 @@ import (
"go_dreamfactory/utils"
"testing"
"time"
. "github.com/smartystreets/goconvey/convey"
)
func TestIsToday(t *testing.T) {
@ -13,6 +15,14 @@ func TestIsToday(t *testing.T) {
fmt.Println(time.Now().Before(tt))
}
func TestIsYestoday(t *testing.T) {
Convey("昨天", t, func() {
b := utils.IsYestoday(1661912369)
So(b, ShouldEqual, true)
})
}
func TestSubTime(t *testing.T) {
fmt.Println(utils.IsAfterWeek(1657172915))
}