支线剧情任务

This commit is contained in:
wh_zcy 2022-11-15 19:27:31 +08:00
parent 2ab6d09c06
commit 0fdcf421dd
29 changed files with 844 additions and 1152 deletions

View File

@ -1,19 +0,0 @@
[
{
"id": 1,
"stroy": 101,
"name": "line_1007",
"cond": [
101
],
"img": "",
"taskid": [
1001,
1002,
1003,
1004,
1005,
1006
]
}
]

View File

@ -1,70 +0,0 @@
[
{
"id": 100101,
"preTId": -1,
"nextTId": 100102,
"cond": [
101,
102
],
"reward": [
{
"a": "attr",
"t": "gold",
"n": 100
},
{
"a": "attr",
"t": "diamond",
"n": 10
}
]
},
{
"id": 100102,
"preTId": 100101,
"nextTId": 100103,
"cond": [
104
],
"reward": [
{
"a": "attr",
"t": "gold",
"n": 100
},
{
"a": "attr",
"t": "diamond",
"n": 10
}
]
},
{
"id": 100103,
"preTId": 100102,
"nextTId": 100104,
"cond": [
106
],
"reward": []
},
{
"id": 100104,
"preTId": 100103,
"nextTId": 100105,
"cond": [
108
],
"reward": []
},
{
"id": 100105,
"preTId": 100103,
"nextTId": -1,
"cond": [
109
],
"reward": []
}
]

View File

@ -1,107 +0,0 @@
[
{
"id": 1001,
"preTId": -1,
"stageTId": [
100101,
100102
],
"reward": [
{
"a": "attr",
"t": "gold",
"n": 100
},
{
"a": "attr",
"t": "diamond",
"n": 10
}
],
"finish": 0,
"ending": 1,
"resetto": -1
},
{
"id": 1002,
"preTId": 1001,
"stageTId": [
100101,
100102
],
"reward": [
{
"a": "attr",
"t": "gold",
"n": 100
},
{
"a": "attr",
"t": "diamond",
"n": 10
}
],
"finish": 0,
"ending": 1,
"resetto": -1
},
{
"id": 1003,
"preTId": 1002,
"stageTId": [
100101,
100102
],
"reward": [
{
"a": "attr",
"t": "gold",
"n": 100
},
{
"a": "attr",
"t": "diamond",
"n": 10
}
],
"finish": 0,
"ending": 1,
"resetto": -1
},
{
"id": 1004,
"preTId": 1002,
"stageTId": [
100101,
100102
],
"reward": [],
"finish": 1,
"ending": 0,
"resetto": 1001
},
{
"id": 1005,
"preTId": 1003,
"stageTId": [
100101,
100102
],
"reward": [],
"finish": 0,
"ending": 1,
"resetto": -1
},
{
"id": 1006,
"preTId": 1005,
"stageTId": [
100101,
100102
],
"reward": [],
"finish": 1,
"ending": 1,
"resetto": -1
}
]

View File

@ -1,6 +1,5 @@
[
{
"index": 1,
"group": 10001,
"nodeIndex": 0,
"cond": [],
@ -23,10 +22,11 @@
]
},
{
"index": 2,
"group": 10001,
"nodeIndex": 0,
"cond": [],
"group": 10002,
"nodeIndex": 1,
"cond": [
10001
],
"name": {
"key": "阿宝的成长2",
"text": "阿宝的成长2"
@ -46,10 +46,11 @@
]
},
{
"index": 3,
"group": 10001,
"nodeIndex": 0,
"cond": [],
"group": 10003,
"nodeIndex": 1,
"cond": [
10001
],
"name": {
"key": "阿宝的成长3",
"text": "阿宝的成长3"
@ -69,10 +70,11 @@
]
},
{
"index": 4,
"group": 10001,
"nodeIndex": 0,
"cond": [],
"group": 10004,
"nodeIndex": 2,
"cond": [
10003
],
"name": {
"key": "阿宝的成长4",
"text": "阿宝的成长4"
@ -92,10 +94,11 @@
]
},
{
"index": 5,
"group": 10001,
"nodeIndex": 0,
"cond": [],
"group": 10005,
"nodeIndex": 2,
"cond": [
10003
],
"name": {
"key": "阿宝的成长5",
"text": "阿宝的成长5"
@ -115,10 +118,11 @@
]
},
{
"index": 6,
"group": 10001,
"nodeIndex": 0,
"cond": [],
"group": 10006,
"nodeIndex": 3,
"cond": [
10005
],
"name": {
"key": "阿宝的成长6",
"text": "阿宝的成长6"
@ -138,10 +142,11 @@
]
},
{
"index": 7,
"group": 10001,
"nodeIndex": 0,
"cond": [],
"group": 10007,
"nodeIndex": 4,
"cond": [
10006
],
"name": {
"key": "阿宝的成长7",
"text": "阿宝的成长7"
@ -161,10 +166,11 @@
]
},
{
"index": 8,
"group": 10001,
"nodeIndex": 0,
"cond": [],
"group": 10008,
"nodeIndex": 5,
"cond": [
10007
],
"name": {
"key": "阿宝的成长8",
"text": "阿宝的成长8"

View File

@ -1,53 +0,0 @@
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,113 @@
package formview
import (
"fmt"
"go_dreamfactory/cmd/v2/lib/common"
"go_dreamfactory/cmd/v2/model"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/cmd/v2/service/observer"
"go_dreamfactory/comm"
"go_dreamfactory/modules/linestory"
"go_dreamfactory/pb"
"strings"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/widget"
"github.com/sirupsen/logrus"
"github.com/spf13/cast"
)
type LinestoryMineView struct {
BaseformView
friendList func()
itemList *common.ItemList
flag bool
}
func (this *LinestoryMineView) CreateView(t *model.TestCase) fyne.CanvasObject {
jqId := widget.NewEntry()
jqId.PlaceHolder = "章节ID"
this.form.AppendItem(widget.NewFormItem("章节ID", jqId))
mine := func() {
if err := service.GetPttService().SendToClient(
t.MainType,
linestory.LinestorySubTypeChapter,
&pb.LinestoryChapterReq{},
); err != nil {
logrus.Error(err)
return
}
}
defer mine()
// 进入章节
this.form.OnSubmit = func() {
if jqId.Text == "" {
common.ShowTip("输入章节ID")
return
}
if err := service.GetPttService().SendToClient(
t.MainType,
linestory.LinestorySubTypeMaintask,
&pb.LinestoryMaintaskReq{
ChapterId: cast.ToInt32(jqId.Text),
},
); err != nil {
logrus.Error(err)
return
}
}
this.form.SubmitText = "进入章节"
// 章节奖励
this.form.OnCancel = func() {
if jqId.Text == "" {
common.ShowTip("输入章节ID")
return
}
if err := service.GetPttService().SendToClient(
t.MainType,
linestory.LinestorySubTypeReceive,
&pb.LinestoryReceiveReq{
ChapterId: cast.ToInt32(jqId.Text),
},
); err != nil {
logrus.Error(err)
return
}
}
this.form.CancelText = "领奖励"
this.dataListener()
return this.form
}
func (this *LinestoryMineView) dataListener() {
if this.flag {
return
}
this.obs.AddListener(observer.EVENT_REQ_RSP, observer.Listener{
OnNotify: func(d interface{}, args ...interface{}) {
data := d.(*pb.UserMessage)
if !(data.MainType == string(comm.ModuleLinestory) &&
data.SubType == linestory.LinestorySubTypeMaintask) {
return
}
rsp := &pb.LinestoryMaintaskResp{}
if !comm.ProtoUnmarshal(data, rsp) {
logrus.Error("unmarshal err")
return
}
var formatStr strings.Builder
for _, v := range rsp.List {
formatStr.WriteString(fmt.Sprintf("%d- %v\n", v.TaskId, v.Status))
}
this.res.Text = formatStr.String()
this.res.Refresh()
},
})
this.flag = true
}

View File

@ -1,43 +0,0 @@
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

@ -6,8 +6,9 @@ import (
)
const (
LinestorySubTypeDostart = "dostart" //开始
LinestorySubTypeDotask = "dotask" //做任务
LinestorySubTypeChapter = "chapter" //章节
LinestorySubTypeMaintask = "maintask" //主线任务
LinestorySubTypeReceive = "receive" //领取章节奖励
)
type apiComp struct {

View File

@ -0,0 +1,26 @@
package linestory
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 支线剧情任务-章节
func (this *apiComp) ChapterCheck(session comm.IUserSession, req *pb.LinestoryChapterReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) Chapter(session comm.IUserSession, req *pb.LinestoryChapterReq) (code pb.ErrorCode, data proto.Message) {
uid := session.GetUserId()
taskMap := this.moduleLinestory.modelLinestory.getChapters(uid)
rsp := &pb.LinestoryChapterResp{
TaskChapter: taskMap,
}
if err := session.SendMsg(string(this.moduleLinestory.GetType()), LinestorySubTypeChapter, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -1,151 +0,0 @@
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
}
rsp := &pb.LinestoryDotaskResp{}
defer func() {
if err := session.SendMsg(string(this.moduleLinestory.GetType()), LinestorySubTypeDotask, rsp); err != nil {
code = pb.ErrorCode_SystemError
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
}
var curTask *pb.TaskNode //当前任务
if dbLinestory.Tasks == nil {
dbLinestory.Tasks = make(map[int32]*pb.TaskNode)
curTask = &pb.TaskNode{}
dbLinestory.Tasks[req.TaskId] = curTask
} else {
if v, ok := dbLinestory.Tasks[req.TaskId]; ok {
curTask = v
// 是否被禁止进入
if v.Status == 3 {
code = pb.ErrorCode_LinestoryTaskDisabledEnter
return
}
}
}
//校验前置
if conf.PreTId != -1 {
if tn, ok := dbLinestory.Tasks[conf.PreTId]; !ok {
code = pb.ErrorCode_LinestoryPreTaskNoFinished
return
} else {
if tn.Status != 2 {
code = pb.ErrorCode_LinestoryPreTaskNoFinished
return
}
}
}
// 判此任务是否是结局
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 _, ok := utils.Findx(curTask.SubtaskIds, req.SubtaskId); ok {
code = pb.ErrorCode_LinestorySubTaskFinished
return
}
// 校验子任务前置是否完成
if stageConf.PreTId != -1 {
if _, ok := utils.Findx(curTask.SubtaskIds, stageConf.PreTId); !ok {
code = pb.ErrorCode_LinestoryPreTaskNoFinished
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 stageConf.Cond {
if code = m.CheckCondi(session.GetUserId(), condiId); code != pb.ErrorCode_Success {
return
}
}
// 全部符合条件
curTask.SubtaskIds = append(curTask.SubtaskIds, req.SubtaskId)
if len(conf.StageTId) == len(curTask.SubtaskIds) {
curTask.Status = 2 //完成
// 发任务奖励
if code = this.moduleLinestory.DispenseRes(session, conf.Reward, true); code != pb.ErrorCode_Success {
log.Errorf("%v", code)
}
} else {
curTask.Status = 1 //进行中
}
dbLinestory.Tasks[conf.Id] = curTask
}
// 更新子任务
update := map[string]interface{}{
"tasks": dbLinestory.Tasks,
}
if err := this.moduleLinestory.modelLinestory.Change(session.GetUserId(), update); err != nil {
code = pb.ErrorCode_DBError
return
}
//派发子任务奖励
code = this.moduleLinestory.DispenseRes(session, stageConf.Reward, true)
return
}

View File

@ -0,0 +1,37 @@
package linestory
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 支线剧情-我的主线任务
func (this *apiComp) MaintaskCheck(session comm.IUserSession, req *pb.LinestoryMaintaskReq) (code pb.ErrorCode) {
if req.ChapterId == 0 {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Maintask(session comm.IUserSession, req *pb.LinestoryMaintaskReq) (code pb.ErrorCode, data proto.Message) {
if code = this.MaintaskCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
// 我的主线任务
list := this.moduleLinestory.modelLinestory.getMaintasks(uid, req.ChapterId)
rsp := &pb.LinestoryMaintaskResp{
List: list,
}
if err := session.SendMsg(string(this.moduleLinestory.GetType()), LinestorySubTypeMaintask, rsp); err != nil {
code = pb.ErrorCode_SystemError
return
}
return
}

View File

@ -0,0 +1,55 @@
package linestory
import (
"errors"
"go_dreamfactory/comm"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 章节奖励领取
func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.LinestoryReceiveReq) (code pb.ErrorCode) {
if req.ChapterId == 0 {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Receive(session comm.IUserSession, req *pb.LinestoryReceiveReq) (code pb.ErrorCode, data proto.Message) {
if code = this.ReceiveCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
conf := this.moduleLinestory.configure.getChapterCfgById(req.ChapterId)
if conf == nil {
log.Errorf("config is nil uid:%v groupId:%v", uid, req.ChapterId)
code = pb.ErrorCode_ConfigNoFound
return
}
if err := this.moduleLinestory.modelLinestory.receive(uid, req.ChapterId); err != nil {
var customErr = new(comm.CustomError)
if errors.As(err, &customErr) {
code = customErr.Code
} else {
code = pb.ErrorCode_DBError
}
this.moduleLinestory.Error("章节奖励领取失败", log.Fields{"uid": uid, "chapterId": req.ChapterId, "code": code})
return
}
//发奖
if code := this.moduleLinestory.DispenseRes(session, conf.Reward, true); code != pb.ErrorCode_Success {
this.moduleLinestory.Errorf("奖励发放失败 uid:%v groupId:%v reward:%v", uid, req.ChapterId, conf.Reward)
}
rsp := &pb.LinestoryReceiveResp{
ChapterId: req.ChapterId,
}
if err := session.SendMsg(string(this.moduleLinestory.GetType()), LinestorySubTypeReceive, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -1,77 +0,0 @@
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) {
if code = this.DostartCheck(session, req); 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
}
}()
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.GetUserId(), condiId); code != pb.ErrorCode_Success {
return
}
}
}
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
}

View File

@ -9,9 +9,8 @@ import (
)
const (
gameLinestoryChapter = "game_linestorychapter.json"
gameLinestoryTask = "game_linestorytask.json"
gameLinestoryStagetask = "game_linestorystagetask.json"
gameLinestoryTimeline = "game_linestorytimeline.json"
gameLinestoryMainTask = "game_linestorymaintask.json"
)
type configureComp struct {
@ -21,22 +20,21 @@ type configureComp struct {
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,
gameLinestoryTimeline: cfg.NewGameLinestoryTimeLine,
gameLinestoryMainTask: cfg.NewGameLinestoryMainTask,
})
return
}
func (this *configureComp) getLinestoryChapterCfg() (data *cfg.GameLineStoryChapter, err error) {
func (this *configureComp) getLinestoryTimelineCfg() (data *cfg.GameLinestoryTimeLine, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameLinestoryChapter); err != nil {
if v, err = this.GetConfigure(gameLinestoryTimeline); err != nil {
return
} else {
if data, ok = v.(*cfg.GameLineStoryChapter); !ok {
if data, ok = v.(*cfg.GameLinestoryTimeLine); !ok {
err = fmt.Errorf("%T no is *cfg.GameLineStoryChapter", v)
return
}
@ -44,15 +42,15 @@ func (this *configureComp) getLinestoryChapterCfg() (data *cfg.GameLineStoryChap
return
}
func (this *configureComp) getLinestoryTaskCfg() (data *cfg.GameLineStoryTask, err error) {
func (this *configureComp) getLinestoryMainTaskCfg() (data *cfg.GameLinestoryMainTask, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameLinestoryTask); err != nil {
if v, err = this.GetConfigure(gameLinestoryMainTask); err != nil {
return
} else {
if data, ok = v.(*cfg.GameLineStoryTask); !ok {
if data, ok = v.(*cfg.GameLinestoryMainTask); !ok {
err = fmt.Errorf("%T no is *cfg.GameLineStoryTask", v)
return
}
@ -60,24 +58,8 @@ func (this *configureComp) getLinestoryTaskCfg() (data *cfg.GameLineStoryTask, e
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 {
func (this *configureComp) getChapterCfgById(id int32) (data *cfg.GameLinestoryTimeLineData) {
if cfg, err := this.getLinestoryTimelineCfg(); err != nil {
log.Errorf("%v", err)
return
} else {
@ -88,8 +70,8 @@ func (this *configureComp) getLinestoryChapterCfgById(id int32) (data *cfg.GameL
return
}
func (this *configureComp) getLinestoryTaskCfgById(id int32) (data *cfg.GameLineStoryTaskData) {
if cfg, err := this.getLinestoryTaskCfg(); err != nil {
func (this *configureComp) getMainTaskCfgById(id int32) (data *cfg.GameLinestoryMainTaskData) {
if cfg, err := this.getLinestoryMainTaskCfg(); err != nil {
log.Errorf("%v", err)
return
} else {
@ -100,13 +82,29 @@ func (this *configureComp) getLinestoryTaskCfgById(id int32) (data *cfg.GameLine
return
}
func (this *configureComp) getLinestoryStageCfgById(id int32) (data *cfg.GameLineStoryStageTaskData) {
if cfg, err := this.getLinestoryStageCfg(); err != nil {
func (this *configureComp) getMainTaskCfgByGroup(groupId int32) (data []*cfg.GameLinestoryMainTaskData) {
if cfg, err := this.getLinestoryMainTaskCfg(); err != nil {
log.Errorf("%v", err)
return
} else {
if cfg != nil {
data = cfg.GetDataMap()[id]
for _, v := range cfg.GetDataList() {
if v.Group == groupId {
data = append(data, v)
}
}
}
}
return
}
func (this *configureComp) converArr(groupId int32) (taskIds []int32) {
data := this.getMainTaskCfgByGroup(groupId)
if data != nil {
for _, v := range data {
if v.Group == groupId {
taskIds = append(taskIds, v.Id)
}
}
}
return

View File

@ -3,7 +3,12 @@ package linestory
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
)
type ModelLinestory struct {
@ -19,3 +24,73 @@ func (this *ModelLinestory) Init(service core.IService, module core.IModule, com
this.service = service
return
}
func (this *ModelLinestory) getLinestory(uid string) *pb.DBLinestory {
ls := &pb.DBLinestory{
Uid: uid,
}
if err := this.Get(uid, ls); err != nil {
if err == mongo.ErrNoDocuments {
ls.Id = primitive.NewObjectID().Hex()
if err := this.Add(uid, ls); err != nil {
log.Errorf("save linestory err:%v", err)
return ls
}
return ls
} else {
log.Errorf("getLinestory err:%v", err)
return ls
}
}
return ls
}
// 获取章节节点信息
func (this *ModelLinestory) getChapters(uid string) map[int32]*pb.TaskChapter {
ls := this.getLinestory(uid)
return ls.TaskChapter
}
// 获取玩家支线剧情-主线任务
func (this *ModelLinestory) getMaintasks(uid string, groupId int32) (list []*pb.TaskMain) {
// 调用世界任务接口groupId & taskId
if module, err := this.service.GetModule(comm.ModuleWorldtask); err == nil {
if iwt, ok := module.(comm.IWorldtask); ok {
// 获取玩家世界任务
wt := iwt.GetMyWorldtask(uid)
if wt != nil {
mainTasks := this.moduleLinestory.configure.getMainTaskCfgByGroup(groupId)
for _, conf := range mainTasks {
// 遍历已完成的世界任务
for _, task := range wt.TaskList {
if conf.Id == task.TaskId {
list = append(list, &pb.TaskMain{
TaskId: conf.Id,
Status: 2,
})
}
}
}
}
}
}
return
}
// 章节奖励领取
func (this *ModelLinestory) receive(uid string, groupId int32) (err error) {
ls := this.getLinestory(uid)
if v, ok := ls.TaskChapter[groupId]; ok {
if v.Receive == 1 {
v.Receive = 2
update := map[string]interface{}{
"receive": v.Receive,
}
return this.Change(uid, update)
} else {
return comm.NewCustomError(pb.ErrorCode_LinestoryNoReceive)
}
}
return comm.NewCustomError(pb.ErrorCode_LinestoryChapterNoOpen)
}

View File

@ -7,13 +7,20 @@ import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"go_dreamfactory/utils"
)
var _ comm.ILinestory = (*ModuleLinestory)(nil)
type ModuleLinestory struct {
modules.ModuleBase
api *apiComp
configure *configureComp
modelLinestory *ModelLinestory
confTimeline *cfg.GameLinestoryTimeLine
confMaintask *cfg.GameLinestoryMainTask
}
func NewModule() core.IModule {
@ -35,3 +42,43 @@ func (this *ModuleLinestory) OnInstallComp() {
func (this *ModuleLinestory) GetType() core.M_Modules {
return comm.ModuleLinestory
}
func (this *ModuleLinestory) Start() (err error) {
err = this.ModuleBase.Start()
if this.confTimeline, err = this.configure.getLinestoryTimelineCfg(); err != nil {
return err
}
if this.confMaintask, err = this.configure.getLinestoryMainTaskCfg(); err != nil {
return err
}
return
}
// 世界任务完成通知
func (this *ModuleLinestory) TaskFinishNotify(uid string, taskId, groupId int32) error {
ls := this.modelLinestory.getLinestory(uid)
if v, ok := ls.TaskChapter[groupId]; ok {
if _, ok := utils.Findx(v.TaskIds, taskId); !ok {
v.TaskIds = append(v.TaskIds, taskId)
taskIds := this.configure.converArr(groupId)
// 校验当前组下的任务是否全部完成
if utils.ForContainer(taskIds, v.TaskIds) {
//说明组里的所有任务完成
v.Receive = 1
v.Status = 1
}
}
} else {
tg := &pb.TaskChapter{}
tg.TaskIds = append(tg.TaskIds, taskId)
if ls.TaskChapter == nil {
ls.TaskChapter = make(map[int32]*pb.TaskChapter)
}
ls.TaskChapter[groupId] = tg
}
update := map[string]interface{}{
"taskChapter": ls.TaskChapter,
}
return this.modelLinestory.Change(uid, update)
}

View File

@ -20,77 +20,20 @@ const (
_ = 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"` //任务
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
TaskChapter map[int32]*TaskChapter `protobuf:"bytes,3,rep,name=taskChapter,proto3" json:"taskChapter" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" bson:"taskChapter"` //已开启的章节 key:章节ID
}
func (x *DBLinestory) Reset() {
*x = DBLinestory{}
if protoimpl.UnsafeEnabled {
mi := &file_linestory_linestory_db_proto_msgTypes[1]
mi := &file_linestory_linestory_db_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -103,7 +46,7 @@ func (x *DBLinestory) String() string {
func (*DBLinestory) ProtoMessage() {}
func (x *DBLinestory) ProtoReflect() protoreflect.Message {
mi := &file_linestory_linestory_db_proto_msgTypes[1]
mi := &file_linestory_linestory_db_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -116,7 +59,7 @@ func (x *DBLinestory) ProtoReflect() protoreflect.Message {
// Deprecated: Use DBLinestory.ProtoReflect.Descriptor instead.
func (*DBLinestory) Descriptor() ([]byte, []int) {
return file_linestory_linestory_db_proto_rawDescGZIP(), []int{1}
return file_linestory_linestory_db_proto_rawDescGZIP(), []int{0}
}
func (x *DBLinestory) GetId() string {
@ -133,42 +76,161 @@ func (x *DBLinestory) GetUid() string {
return ""
}
func (x *DBLinestory) GetJqId() int32 {
func (x *DBLinestory) GetTaskChapter() map[int32]*TaskChapter {
if x != nil {
return x.JqId
return x.TaskChapter
}
return nil
}
// 章节
type TaskChapter struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Receive int32 `protobuf:"varint,1,opt,name=receive,proto3" json:"receive" bson:"receive"` //章节奖励领取状态 0未领 1待领取 2已领取
Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status" bson:"status"` //完成状态 0未完成 1已完成
TaskIds []int32 `protobuf:"varint,3,rep,packed,name=taskIds,proto3" json:"taskIds" bson:"taskIds"` //完成的任务
}
func (x *TaskChapter) Reset() {
*x = TaskChapter{}
if protoimpl.UnsafeEnabled {
mi := &file_linestory_linestory_db_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TaskChapter) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TaskChapter) ProtoMessage() {}
func (x *TaskChapter) 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 TaskChapter.ProtoReflect.Descriptor instead.
func (*TaskChapter) Descriptor() ([]byte, []int) {
return file_linestory_linestory_db_proto_rawDescGZIP(), []int{1}
}
func (x *TaskChapter) GetReceive() int32 {
if x != nil {
return x.Receive
}
return 0
}
func (x *DBLinestory) GetTasks() map[int32]*TaskNode {
func (x *TaskChapter) GetStatus() int32 {
if x != nil {
return x.Tasks
return x.Status
}
return 0
}
func (x *TaskChapter) GetTaskIds() []int32 {
if x != nil {
return x.TaskIds
}
return nil
}
// 主线任务
type TaskMain struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId" bson:"taskId"` //任务Id
Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status" bson:"status"` //状态 0锁定 1已完成
}
func (x *TaskMain) Reset() {
*x = TaskMain{}
if protoimpl.UnsafeEnabled {
mi := &file_linestory_linestory_db_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TaskMain) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TaskMain) ProtoMessage() {}
func (x *TaskMain) ProtoReflect() protoreflect.Message {
mi := &file_linestory_linestory_db_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 TaskMain.ProtoReflect.Descriptor instead.
func (*TaskMain) Descriptor() ([]byte, []int) {
return file_linestory_linestory_db_proto_rawDescGZIP(), []int{2}
}
func (x *TaskMain) GetTaskId() int32 {
if x != nil {
return x.TaskId
}
return 0
}
func (x *TaskMain) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
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,
0x73, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbe,
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, 0x3f, 0x0a, 0x0b, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x18,
0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x44, 0x42, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74,
0x6f, 0x72, 0x79, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x45,
0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65,
0x72, 0x1a, 0x4c, 0x0a, 0x10, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72,
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,
0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x22, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61,
0x70, 0x74, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22,
0x59, 0x0a, 0x0b, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x12, 0x18,
0x0a, 0x07, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x07, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74,
0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
0x12, 0x18, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28,
0x05, 0x52, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x22, 0x3a, 0x0a, 0x08, 0x54, 0x61,
0x73, 0x6b, 0x4d, 0x61, 0x69, 0x6e, 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, 0x16,
0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06,
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -183,15 +245,16 @@ func file_linestory_linestory_db_proto_rawDescGZIP() []byte {
return file_linestory_linestory_db_proto_rawDescData
}
var file_linestory_linestory_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_linestory_linestory_db_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_linestory_linestory_db_proto_goTypes = []interface{}{
(*TaskNode)(nil), // 0: TaskNode
(*DBLinestory)(nil), // 1: DBLinestory
nil, // 2: DBLinestory.TasksEntry
(*DBLinestory)(nil), // 0: DBLinestory
(*TaskChapter)(nil), // 1: TaskChapter
(*TaskMain)(nil), // 2: TaskMain
nil, // 3: DBLinestory.TaskChapterEntry
}
var file_linestory_linestory_db_proto_depIdxs = []int32{
2, // 0: DBLinestory.tasks:type_name -> DBLinestory.TasksEntry
0, // 1: DBLinestory.TasksEntry.value:type_name -> TaskNode
3, // 0: DBLinestory.taskChapter:type_name -> DBLinestory.TaskChapterEntry
1, // 1: DBLinestory.TaskChapterEntry.value:type_name -> TaskChapter
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
@ -206,7 +269,7 @@ func file_linestory_linestory_db_proto_init() {
}
if !protoimpl.UnsafeEnabled {
file_linestory_linestory_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TaskNode); i {
switch v := v.(*DBLinestory); i {
case 0:
return &v.state
case 1:
@ -218,7 +281,19 @@ func file_linestory_linestory_db_proto_init() {
}
}
file_linestory_linestory_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBLinestory); i {
switch v := v.(*TaskChapter); 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[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TaskMain); i {
case 0:
return &v.state
case 1:
@ -236,7 +311,7 @@ func file_linestory_linestory_db_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_linestory_linestory_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -20,17 +20,15 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// 剧情开始
type LinestoryStartReq struct {
// 支线剧情章节
type LinestoryChapterReq 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{}
func (x *LinestoryChapterReq) Reset() {
*x = LinestoryChapterReq{}
if protoimpl.UnsafeEnabled {
mi := &file_linestory_linestory_msg_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -38,13 +36,13 @@ func (x *LinestoryStartReq) Reset() {
}
}
func (x *LinestoryStartReq) String() string {
func (x *LinestoryChapterReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LinestoryStartReq) ProtoMessage() {}
func (*LinestoryChapterReq) ProtoMessage() {}
func (x *LinestoryStartReq) ProtoReflect() protoreflect.Message {
func (x *LinestoryChapterReq) ProtoReflect() protoreflect.Message {
mi := &file_linestory_linestory_msg_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -56,29 +54,21 @@ func (x *LinestoryStartReq) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use LinestoryStartReq.ProtoReflect.Descriptor instead.
func (*LinestoryStartReq) Descriptor() ([]byte, []int) {
// Deprecated: Use LinestoryChapterReq.ProtoReflect.Descriptor instead.
func (*LinestoryChapterReq) 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 {
type LinestoryChapterResp 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
TaskChapter map[int32]*TaskChapter `protobuf:"bytes,1,rep,name=taskChapter,proto3" json:"taskChapter" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}
func (x *LinestoryStartResp) Reset() {
*x = LinestoryStartResp{}
func (x *LinestoryChapterResp) Reset() {
*x = LinestoryChapterResp{}
if protoimpl.UnsafeEnabled {
mi := &file_linestory_linestory_msg_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -86,13 +76,13 @@ func (x *LinestoryStartResp) Reset() {
}
}
func (x *LinestoryStartResp) String() string {
func (x *LinestoryChapterResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LinestoryStartResp) ProtoMessage() {}
func (*LinestoryChapterResp) ProtoMessage() {}
func (x *LinestoryStartResp) ProtoReflect() protoreflect.Message {
func (x *LinestoryChapterResp) ProtoReflect() protoreflect.Message {
mi := &file_linestory_linestory_msg_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -104,37 +94,29 @@ func (x *LinestoryStartResp) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use LinestoryStartResp.ProtoReflect.Descriptor instead.
func (*LinestoryStartResp) Descriptor() ([]byte, []int) {
// Deprecated: Use LinestoryChapterResp.ProtoReflect.Descriptor instead.
func (*LinestoryChapterResp) Descriptor() ([]byte, []int) {
return file_linestory_linestory_msg_proto_rawDescGZIP(), []int{1}
}
func (x *LinestoryStartResp) GetJqId() int32 {
func (x *LinestoryChapterResp) GetTaskChapter() map[int32]*TaskChapter {
if x != nil {
return x.JqId
}
return 0
}
func (x *LinestoryStartResp) GetTaskIds() []int32 {
if x != nil {
return x.TaskIds
return x.TaskChapter
}
return nil
}
// 任务
type LinestoryDotaskReq struct {
// 支线剧情-我的主线任务
type LinestoryMaintaskReq 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
ChapterId int32 `protobuf:"varint,1,opt,name=chapterId,proto3" json:"chapterId"` //章节ID
}
func (x *LinestoryDotaskReq) Reset() {
*x = LinestoryDotaskReq{}
func (x *LinestoryMaintaskReq) Reset() {
*x = LinestoryMaintaskReq{}
if protoimpl.UnsafeEnabled {
mi := &file_linestory_linestory_msg_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -142,13 +124,13 @@ func (x *LinestoryDotaskReq) Reset() {
}
}
func (x *LinestoryDotaskReq) String() string {
func (x *LinestoryMaintaskReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LinestoryDotaskReq) ProtoMessage() {}
func (*LinestoryMaintaskReq) ProtoMessage() {}
func (x *LinestoryDotaskReq) ProtoReflect() protoreflect.Message {
func (x *LinestoryMaintaskReq) ProtoReflect() protoreflect.Message {
mi := &file_linestory_linestory_msg_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -160,37 +142,28 @@ func (x *LinestoryDotaskReq) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use LinestoryDotaskReq.ProtoReflect.Descriptor instead.
func (*LinestoryDotaskReq) Descriptor() ([]byte, []int) {
// Deprecated: Use LinestoryMaintaskReq.ProtoReflect.Descriptor instead.
func (*LinestoryMaintaskReq) Descriptor() ([]byte, []int) {
return file_linestory_linestory_msg_proto_rawDescGZIP(), []int{2}
}
func (x *LinestoryDotaskReq) GetTaskId() int32 {
func (x *LinestoryMaintaskReq) GetChapterId() int32 {
if x != nil {
return x.TaskId
return x.ChapterId
}
return 0
}
func (x *LinestoryDotaskReq) GetSubtaskId() int32 {
if x != nil {
return x.SubtaskId
}
return 0
}
type LinestoryDotaskResp struct {
type LinestoryMaintaskResp 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
List []*TaskMain `protobuf:"bytes,1,rep,name=list,proto3" json:"list"`
}
func (x *LinestoryDotaskResp) Reset() {
*x = LinestoryDotaskResp{}
func (x *LinestoryMaintaskResp) Reset() {
*x = LinestoryMaintaskResp{}
if protoimpl.UnsafeEnabled {
mi := &file_linestory_linestory_msg_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -198,13 +171,13 @@ func (x *LinestoryDotaskResp) Reset() {
}
}
func (x *LinestoryDotaskResp) String() string {
func (x *LinestoryMaintaskResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LinestoryDotaskResp) ProtoMessage() {}
func (*LinestoryMaintaskResp) ProtoMessage() {}
func (x *LinestoryDotaskResp) ProtoReflect() protoreflect.Message {
func (x *LinestoryMaintaskResp) ProtoReflect() protoreflect.Message {
mi := &file_linestory_linestory_msg_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -216,28 +189,109 @@ func (x *LinestoryDotaskResp) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use LinestoryDotaskResp.ProtoReflect.Descriptor instead.
func (*LinestoryDotaskResp) Descriptor() ([]byte, []int) {
// Deprecated: Use LinestoryMaintaskResp.ProtoReflect.Descriptor instead.
func (*LinestoryMaintaskResp) Descriptor() ([]byte, []int) {
return file_linestory_linestory_msg_proto_rawDescGZIP(), []int{3}
}
func (x *LinestoryDotaskResp) GetTaskId() int32 {
func (x *LinestoryMaintaskResp) GetList() []*TaskMain {
if x != nil {
return x.TaskId
return x.List
}
return nil
}
// 章节奖励领取
type LinestoryReceiveReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ChapterId int32 `protobuf:"varint,1,opt,name=chapterId,proto3" json:"chapterId"`
}
func (x *LinestoryReceiveReq) Reset() {
*x = LinestoryReceiveReq{}
if protoimpl.UnsafeEnabled {
mi := &file_linestory_linestory_msg_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LinestoryReceiveReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LinestoryReceiveReq) ProtoMessage() {}
func (x *LinestoryReceiveReq) 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 LinestoryReceiveReq.ProtoReflect.Descriptor instead.
func (*LinestoryReceiveReq) Descriptor() ([]byte, []int) {
return file_linestory_linestory_msg_proto_rawDescGZIP(), []int{4}
}
func (x *LinestoryReceiveReq) GetChapterId() int32 {
if x != nil {
return x.ChapterId
}
return 0
}
func (x *LinestoryDotaskResp) GetSubtaskId() int32 {
if x != nil {
return x.SubtaskId
}
return 0
type LinestoryReceiveResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ChapterId int32 `protobuf:"varint,1,opt,name=chapterId,proto3" json:"chapterId"`
}
func (x *LinestoryDotaskResp) GetResetTaskId() int32 {
func (x *LinestoryReceiveResp) Reset() {
*x = LinestoryReceiveResp{}
if protoimpl.UnsafeEnabled {
mi := &file_linestory_linestory_msg_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LinestoryReceiveResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LinestoryReceiveResp) ProtoMessage() {}
func (x *LinestoryReceiveResp) 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 LinestoryReceiveResp.ProtoReflect.Descriptor instead.
func (*LinestoryReceiveResp) Descriptor() ([]byte, []int) {
return file_linestory_linestory_msg_proto_rawDescGZIP(), []int{5}
}
func (x *LinestoryReceiveResp) GetChapterId() int32 {
if x != nil {
return x.ResetTaskId
return x.ChapterId
}
return 0
}
@ -246,27 +300,36 @@ 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x73, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
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, 0x15, 0x0a,
0x13, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65,
0x72, 0x52, 0x65, 0x71, 0x22, 0xae, 0x01, 0x0a, 0x14, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f,
0x72, 0x79, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x48, 0x0a,
0x0b, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x26, 0x2e, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x68,
0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x68,
0x61, 0x70, 0x74, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x74, 0x61, 0x73, 0x6b,
0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x1a, 0x4c, 0x0a, 0x10, 0x54, 0x61, 0x73, 0x6b, 0x43,
0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x22, 0x0a,
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x54,
0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x34, 0x0a, 0x14, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f,
0x72, 0x79, 0x4d, 0x61, 0x69, 0x6e, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a,
0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x22, 0x36, 0x0a, 0x15, 0x4c,
0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4d, 0x61, 0x69, 0x6e, 0x74, 0x61, 0x73, 0x6b,
0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x09, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x4d, 0x61, 0x69, 0x6e, 0x52, 0x04, 0x6c,
0x69, 0x73, 0x74, 0x22, 0x33, 0x0a, 0x13, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79,
0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68,
0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63,
0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x22, 0x34, 0x0a, 0x14, 0x4c, 0x69, 0x6e, 0x65,
0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70,
0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x42, 0x06,
0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -281,19 +344,27 @@ func file_linestory_linestory_msg_proto_rawDescGZIP() []byte {
return file_linestory_linestory_msg_proto_rawDescData
}
var file_linestory_linestory_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_linestory_linestory_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_linestory_linestory_msg_proto_goTypes = []interface{}{
(*LinestoryStartReq)(nil), // 0: LinestoryStartReq
(*LinestoryStartResp)(nil), // 1: LinestoryStartResp
(*LinestoryDotaskReq)(nil), // 2: LinestoryDotaskReq
(*LinestoryDotaskResp)(nil), // 3: LinestoryDotaskResp
(*LinestoryChapterReq)(nil), // 0: LinestoryChapterReq
(*LinestoryChapterResp)(nil), // 1: LinestoryChapterResp
(*LinestoryMaintaskReq)(nil), // 2: LinestoryMaintaskReq
(*LinestoryMaintaskResp)(nil), // 3: LinestoryMaintaskResp
(*LinestoryReceiveReq)(nil), // 4: LinestoryReceiveReq
(*LinestoryReceiveResp)(nil), // 5: LinestoryReceiveResp
nil, // 6: LinestoryChapterResp.TaskChapterEntry
(*TaskMain)(nil), // 7: TaskMain
(*TaskChapter)(nil), // 8: TaskChapter
}
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
6, // 0: LinestoryChapterResp.taskChapter:type_name -> LinestoryChapterResp.TaskChapterEntry
7, // 1: LinestoryMaintaskResp.list:type_name -> TaskMain
8, // 2: LinestoryChapterResp.TaskChapterEntry.value:type_name -> TaskChapter
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_linestory_linestory_msg_proto_init() }
@ -301,9 +372,10 @@ func file_linestory_linestory_msg_proto_init() {
if File_linestory_linestory_msg_proto != nil {
return
}
file_linestory_linestory_db_proto_init()
if !protoimpl.UnsafeEnabled {
file_linestory_linestory_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LinestoryStartReq); i {
switch v := v.(*LinestoryChapterReq); i {
case 0:
return &v.state
case 1:
@ -315,7 +387,7 @@ func file_linestory_linestory_msg_proto_init() {
}
}
file_linestory_linestory_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LinestoryStartResp); i {
switch v := v.(*LinestoryChapterResp); i {
case 0:
return &v.state
case 1:
@ -327,7 +399,7 @@ func file_linestory_linestory_msg_proto_init() {
}
}
file_linestory_linestory_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LinestoryDotaskReq); i {
switch v := v.(*LinestoryMaintaskReq); i {
case 0:
return &v.state
case 1:
@ -339,7 +411,31 @@ func file_linestory_linestory_msg_proto_init() {
}
}
file_linestory_linestory_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LinestoryDotaskResp); i {
switch v := v.(*LinestoryMaintaskResp); 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.(*LinestoryReceiveReq); 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.(*LinestoryReceiveResp); i {
case 0:
return &v.state
case 1:
@ -357,7 +453,7 @@ func file_linestory_linestory_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_linestory_linestory_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumMessages: 7,
NumExtensions: 0,
NumServices: 0,
},

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 GameLineStoryChapter struct {
_dataMap map[int32]*GameLineStoryChapterData
_dataList []*GameLineStoryChapterData
}
func NewGameLineStoryChapter(_buf []map[string]interface{}) (*GameLineStoryChapter, error) {
_dataList := make([]*GameLineStoryChapterData, 0, len(_buf))
dataMap := make(map[int32]*GameLineStoryChapterData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameLineStoryChapterData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameLineStoryChapter{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameLineStoryChapter) GetDataMap() map[int32]*GameLineStoryChapterData {
return table._dataMap
}
func (table *GameLineStoryChapter) GetDataList() []*GameLineStoryChapterData {
return table._dataList
}
func (table *GameLineStoryChapter) Get(key int32) *GameLineStoryChapterData {
return table._dataMap[key]
}

View File

@ -1,71 +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 GameLineStoryChapterData struct {
Id int32
Stroy int32
Name string
Cond []int32
Img string
Taskid []int32
}
const TypeId_GameLineStoryChapterData = -1620958734
func (*GameLineStoryChapterData) GetTypeId() int32 {
return -1620958734
}
func (_v *GameLineStoryChapterData)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["stroy"].(float64); !_ok_ { err = errors.New("stroy error"); return }; _v.Stroy = int32(_tempNum_) }
{ var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["cond"].([]interface{}); !_ok_ { err = errors.New("cond error"); return }
_v.Cond = 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.Cond = append(_v.Cond, _list_v_)
}
}
{ var _ok_ bool; if _v.Img, _ok_ = _buf["img"].(string); !_ok_ { err = errors.New("img error"); return } }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["taskid"].([]interface{}); !_ok_ { err = errors.New("taskid error"); return }
_v.Taskid = 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.Taskid = append(_v.Taskid, _list_v_)
}
}
return
}
func DeserializeGameLineStoryChapterData(_buf map[string]interface{}) (*GameLineStoryChapterData, error) {
v := &GameLineStoryChapterData{}
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 GameLineStoryStageTask struct {
_dataMap map[int32]*GameLineStoryStageTaskData
_dataList []*GameLineStoryStageTaskData
}
func NewGameLineStoryStageTask(_buf []map[string]interface{}) (*GameLineStoryStageTask, error) {
_dataList := make([]*GameLineStoryStageTaskData, 0, len(_buf))
dataMap := make(map[int32]*GameLineStoryStageTaskData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameLineStoryStageTaskData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameLineStoryStageTask{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameLineStoryStageTask) GetDataMap() map[int32]*GameLineStoryStageTaskData {
return table._dataMap
}
func (table *GameLineStoryStageTask) GetDataList() []*GameLineStoryStageTaskData {
return table._dataList
}
func (table *GameLineStoryStageTask) Get(key int32) *GameLineStoryStageTaskData {
return table._dataMap[key]
}

View File

@ -1,69 +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 GameLineStoryStageTaskData struct {
Id int32
PreTId int32
NextTId int32
Cond []int32
Reward []*Gameatn
}
const TypeId_GameLineStoryStageTaskData = 884678024
func (*GameLineStoryStageTaskData) GetTypeId() int32 {
return 884678024
}
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["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{}
var _ok_ bool
if _arr_, _ok_ = _buf["cond"].([]interface{}); !_ok_ { err = errors.New("cond error"); return }
_v.Cond = 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.Cond = append(_v.Cond, _list_v_)
}
}
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["reward"].([]interface{}); !_ok_ { err = errors.New("reward error"); return }
_v.Reward = make([]*Gameatn, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ *Gameatn
{ 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 = DeserializeGameatn(_x_); err != nil { return } }
_v.Reward = append(_v.Reward, _list_v_)
}
}
return
}
func DeserializeGameLineStoryStageTaskData(_buf map[string]interface{}) (*GameLineStoryStageTaskData, error) {
v := &GameLineStoryStageTaskData{}
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 GameLineStoryTask struct {
_dataMap map[int32]*GameLineStoryTaskData
_dataList []*GameLineStoryTaskData
}
func NewGameLineStoryTask(_buf []map[string]interface{}) (*GameLineStoryTask, error) {
_dataList := make([]*GameLineStoryTaskData, 0, len(_buf))
dataMap := make(map[int32]*GameLineStoryTaskData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameLineStoryTaskData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameLineStoryTask{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameLineStoryTask) GetDataMap() map[int32]*GameLineStoryTaskData {
return table._dataMap
}
func (table *GameLineStoryTask) GetDataList() []*GameLineStoryTaskData {
return table._dataList
}
func (table *GameLineStoryTask) Get(key int32) *GameLineStoryTaskData {
return table._dataMap[key]
}

View File

@ -1,73 +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 GameLineStoryTaskData struct {
Id int32
PreTId int32
StageTId []int32
Reward []*Gameatn
Finish int32
Ending int32
Resetto int32
}
const TypeId_GameLineStoryTaskData = -2080476076
func (*GameLineStoryTaskData) GetTypeId() int32 {
return -2080476076
}
func (_v *GameLineStoryTaskData)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["preTId"].(float64); !_ok_ { err = errors.New("preTId error"); return }; _v.PreTId = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["stageTId"].([]interface{}); !_ok_ { err = errors.New("stageTId error"); return }
_v.StageTId = 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.StageTId = append(_v.StageTId, _list_v_)
}
}
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["reward"].([]interface{}); !_ok_ { err = errors.New("reward error"); return }
_v.Reward = make([]*Gameatn, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ *Gameatn
{ 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 = DeserializeGameatn(_x_); err != nil { return } }
_v.Reward = append(_v.Reward, _list_v_)
}
}
{ 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
}
func DeserializeGameLineStoryTaskData(_buf map[string]interface{}) (*GameLineStoryTaskData, error) {
v := &GameLineStoryTaskData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View File

@ -12,11 +12,10 @@ import "errors"
type GameLinestoryMainTaskData struct {
Id int32
ParetnTask int32
Group int32
SubTask int32
Name string
Img string
Reward []*Gameatn
Ending int32
Resetto []int32
}
@ -29,24 +28,10 @@ func (*GameLinestoryMainTaskData) GetTypeId() int32 {
func (_v *GameLinestoryMainTaskData)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["paretnTask"].(float64); !_ok_ { err = errors.New("paretnTask error"); return }; _v.ParetnTask = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["group"].(float64); !_ok_ { err = errors.New("group error"); return }; _v.Group = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["subTask"].(float64); !_ok_ { err = errors.New("subTask error"); return }; _v.SubTask = 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.Img, _ok_ = _buf["img"].(string); !_ok_ { err = errors.New("img error"); return } }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["reward"].([]interface{}); !_ok_ { err = errors.New("reward error"); return }
_v.Reward = make([]*Gameatn, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ *Gameatn
{ 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 = DeserializeGameatn(_x_); err != nil { return } }
_v.Reward = append(_v.Reward, _list_v_)
}
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["ending"].(float64); !_ok_ { err = errors.New("ending error"); return }; _v.Ending = int32(_tempNum_) }
{
var _arr_ []interface{}

View File

@ -21,7 +21,7 @@ func NewGameLinestoryTimeLine(_buf []map[string]interface{}) (*GameLinestoryTime
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Index] = _v
dataMap[_v.Group] = _v
}
}
return &GameLinestoryTimeLine{_dataList:_dataList, _dataMap:dataMap}, nil

View File

@ -11,7 +11,7 @@ package cfg
import "errors"
type GameLinestoryTimeLineData struct {
Index int32
Group int32
NodeIndex int32
Cond []int32
Name string
@ -26,7 +26,7 @@ func (*GameLinestoryTimeLineData) GetTypeId() int32 {
}
func (_v *GameLinestoryTimeLineData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["index"].(float64); !_ok_ { err = errors.New("index error"); return }; _v.Index = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["group"].(float64); !_ok_ { err = errors.New("group error"); return }; _v.Group = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["nodeIndex"].(float64); !_ok_ { err = errors.New("nodeIndex error"); return }; _v.NodeIndex = int32(_tempNum_) }
{
var _arr_ []interface{}

38
utils/compare.go Normal file
View File

@ -0,0 +1,38 @@
package utils
// 比较切片 比较每个位置的元素
func ForEqual(x, y []int32) bool {
if len(x) != len(y) {
return false
}
if (x == nil) != (y == nil) {
return false
}
for i, v := range x {
if v != y[i] {
return false
}
}
return true
}
func ForContainer(x, y []int32) bool {
if len(x) != len(y) {
return false
}
if (x == nil) != (y == nil) {
return false
}
for _, v := range x {
if _, ok := Findx(y, v); !ok {
return false
}
}
return true
}

View File

@ -1 +0,0 @@
package utils