随机任务
This commit is contained in:
parent
6de3e9e438
commit
d735a6bb15
@ -1,66 +0,0 @@
|
||||
[
|
||||
{
|
||||
"rdtaks_id": 1001,
|
||||
"task_type": 2,
|
||||
"rdtaks_num": [
|
||||
101,
|
||||
102
|
||||
],
|
||||
"id_last": [
|
||||
0
|
||||
],
|
||||
"id_after": 1002,
|
||||
"id_tag": 1,
|
||||
"story": 3,
|
||||
"completetask": 0,
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 10
|
||||
},
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 1000
|
||||
}
|
||||
],
|
||||
"choose_id": [
|
||||
10001,
|
||||
10002,
|
||||
10003
|
||||
]
|
||||
},
|
||||
{
|
||||
"rdtaks_id": 1002,
|
||||
"task_type": 2,
|
||||
"rdtaks_num": [
|
||||
101,
|
||||
104
|
||||
],
|
||||
"id_last": [
|
||||
1001
|
||||
],
|
||||
"id_after": 0,
|
||||
"id_tag": 2,
|
||||
"story": 3,
|
||||
"completetask": 0,
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 15
|
||||
},
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 1500
|
||||
}
|
||||
],
|
||||
"choose_id": [
|
||||
10011,
|
||||
10012,
|
||||
10013
|
||||
]
|
||||
}
|
||||
]
|
@ -1,38 +0,0 @@
|
||||
[
|
||||
{
|
||||
"choose_id": 10001,
|
||||
"num": 1,
|
||||
"rdtaks_num": 104,
|
||||
"rdtaks_id": 0
|
||||
},
|
||||
{
|
||||
"choose_id": 10002,
|
||||
"num": 2,
|
||||
"rdtaks_num": 105,
|
||||
"rdtaks_id": 1002
|
||||
},
|
||||
{
|
||||
"choose_id": 10003,
|
||||
"num": 3,
|
||||
"rdtaks_num": 0,
|
||||
"rdtaks_id": 0
|
||||
},
|
||||
{
|
||||
"choose_id": 10011,
|
||||
"num": 1,
|
||||
"rdtaks_num": 106,
|
||||
"rdtaks_id": 0
|
||||
},
|
||||
{
|
||||
"choose_id": 10012,
|
||||
"num": 2,
|
||||
"rdtaks_num": 107,
|
||||
"rdtaks_id": 0
|
||||
},
|
||||
{
|
||||
"choose_id": 10013,
|
||||
"num": 3,
|
||||
"rdtaks_num": 0,
|
||||
"rdtaks_id": 0
|
||||
}
|
||||
]
|
228
bin/json/game_rdtaskall.json
Normal file
228
bin/json/game_rdtaskall.json
Normal file
@ -0,0 +1,228 @@
|
||||
[
|
||||
{
|
||||
"id": 1001,
|
||||
"type": 2,
|
||||
"lastend": 0,
|
||||
"rdtaks_num": [
|
||||
101
|
||||
],
|
||||
"aftertaks": 1002,
|
||||
"icetime": 0,
|
||||
"tag": 1,
|
||||
"story": 3,
|
||||
"completetask": 0,
|
||||
"chooseid": [
|
||||
10001,
|
||||
1002,
|
||||
1003
|
||||
],
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 10
|
||||
},
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 1000
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1002,
|
||||
"type": 2,
|
||||
"lastend": 1001,
|
||||
"rdtaks_num": [
|
||||
101,
|
||||
102
|
||||
],
|
||||
"aftertaks": 1003,
|
||||
"icetime": 0,
|
||||
"tag": 2,
|
||||
"story": 3,
|
||||
"completetask": 0,
|
||||
"chooseid": [
|
||||
10011,
|
||||
10012,
|
||||
10013
|
||||
],
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 15
|
||||
},
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 1500
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1003,
|
||||
"type": 2,
|
||||
"lastend": 1002,
|
||||
"rdtaks_num": [
|
||||
101,
|
||||
103
|
||||
],
|
||||
"aftertaks": 1004,
|
||||
"icetime": 0,
|
||||
"tag": 1,
|
||||
"story": 3,
|
||||
"completetask": 0,
|
||||
"chooseid": [],
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 15
|
||||
},
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 1500
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1004,
|
||||
"type": 2,
|
||||
"lastend": 1003,
|
||||
"rdtaks_num": [
|
||||
101,
|
||||
103
|
||||
],
|
||||
"aftertaks": 1005,
|
||||
"icetime": 0,
|
||||
"tag": 1,
|
||||
"story": 3,
|
||||
"completetask": 0,
|
||||
"chooseid": [],
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 15
|
||||
},
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 1500
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1005,
|
||||
"type": 2,
|
||||
"lastend": 1004,
|
||||
"rdtaks_num": [
|
||||
104,
|
||||
105
|
||||
],
|
||||
"aftertaks": 1006,
|
||||
"icetime": 0,
|
||||
"tag": 1,
|
||||
"story": 3,
|
||||
"completetask": 0,
|
||||
"chooseid": [],
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 15
|
||||
},
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 1500
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1006,
|
||||
"type": 2,
|
||||
"lastend": 1005,
|
||||
"rdtaks_num": [
|
||||
106
|
||||
],
|
||||
"aftertaks": 0,
|
||||
"icetime": 0,
|
||||
"tag": 1,
|
||||
"story": 3,
|
||||
"completetask": 0,
|
||||
"chooseid": [
|
||||
10021,
|
||||
10022
|
||||
],
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 15
|
||||
},
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 1500
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1007,
|
||||
"type": 1,
|
||||
"lastend": 0,
|
||||
"rdtaks_num": [
|
||||
107
|
||||
],
|
||||
"aftertaks": 1002,
|
||||
"icetime": 1,
|
||||
"tag": 1,
|
||||
"story": 3,
|
||||
"completetask": 0,
|
||||
"chooseid": [],
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 15
|
||||
},
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 1500
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1008,
|
||||
"type": 1,
|
||||
"lastend": 0,
|
||||
"rdtaks_num": [
|
||||
108
|
||||
],
|
||||
"aftertaks": 1002,
|
||||
"icetime": -1,
|
||||
"tag": 1,
|
||||
"story": 3,
|
||||
"completetask": 0,
|
||||
"chooseid": [
|
||||
10041,
|
||||
10042
|
||||
],
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 15
|
||||
},
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 1500
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
98
bin/json/game_rdtaskchoose.json
Normal file
98
bin/json/game_rdtaskchoose.json
Normal file
@ -0,0 +1,98 @@
|
||||
[
|
||||
{
|
||||
"chooseid": 10001,
|
||||
"num": 1,
|
||||
"rdtaks_num": 101,
|
||||
"need": [
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"chooseid": 10002,
|
||||
"num": 2,
|
||||
"rdtaks_num": 107,
|
||||
"need": [
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"chooseid": 10003,
|
||||
"num": 3,
|
||||
"rdtaks_num": 101,
|
||||
"need": [
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"chooseid": 10011,
|
||||
"num": 1,
|
||||
"rdtaks_num": 101,
|
||||
"need": [
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"chooseid": 10012,
|
||||
"num": 2,
|
||||
"rdtaks_num": 101,
|
||||
"need": [
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"chooseid": 10013,
|
||||
"num": 3,
|
||||
"rdtaks_num": 101,
|
||||
"need": [
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"chooseid": 10021,
|
||||
"num": 1,
|
||||
"rdtaks_num": 101,
|
||||
"need": [
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"chooseid": 10022,
|
||||
"num": 2,
|
||||
"rdtaks_num": 101,
|
||||
"need": [
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"chooseid": 10031,
|
||||
"num": 1,
|
||||
"rdtaks_num": 0,
|
||||
"need": [
|
||||
10012
|
||||
]
|
||||
},
|
||||
{
|
||||
"chooseid": 10032,
|
||||
"num": 2,
|
||||
"rdtaks_num": 0,
|
||||
"need": [
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"chooseid": 10041,
|
||||
"num": 1,
|
||||
"rdtaks_num": 0,
|
||||
"need": [
|
||||
10010
|
||||
]
|
||||
},
|
||||
{
|
||||
"chooseid": 10042,
|
||||
"num": 2,
|
||||
"rdtaks_num": 0,
|
||||
"need": [
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
@ -13,7 +13,7 @@
|
||||
"typdes": 2,
|
||||
"datatime": 1,
|
||||
"typtask_id": 2,
|
||||
"data1": 10,
|
||||
"data1": 3,
|
||||
"data2": 0,
|
||||
"data3": 0
|
||||
},
|
||||
@ -22,7 +22,7 @@
|
||||
"typdes": 2,
|
||||
"datatime": 1,
|
||||
"typtask_id": 3,
|
||||
"data1": 3,
|
||||
"data1": 2,
|
||||
"data2": 0,
|
||||
"data3": 0
|
||||
},
|
||||
@ -31,44 +31,44 @@
|
||||
"typdes": 2,
|
||||
"datatime": 1,
|
||||
"typtask_id": 4,
|
||||
"data1": 2,
|
||||
"data2": 0,
|
||||
"data1": 90001,
|
||||
"data2": 15,
|
||||
"data3": 0
|
||||
},
|
||||
{
|
||||
"rdtaks_num": 105,
|
||||
"typdes": 2,
|
||||
"datatime": 1,
|
||||
"typtask_id": 5,
|
||||
"data1": 101,
|
||||
"data2": 0,
|
||||
"typtask_id": 4,
|
||||
"data1": 25001,
|
||||
"data2": 10,
|
||||
"data3": 0
|
||||
},
|
||||
{
|
||||
"rdtaks_num": 106,
|
||||
"typdes": 2,
|
||||
"datatime": 1,
|
||||
"typtask_id": 6,
|
||||
"data1": 3,
|
||||
"data2": 0,
|
||||
"typtask_id": 5,
|
||||
"data1": 90001,
|
||||
"data2": 2,
|
||||
"data3": 0
|
||||
},
|
||||
{
|
||||
"rdtaks_num": 107,
|
||||
"typdes": 2,
|
||||
"datatime": 1,
|
||||
"typtask_id": 7,
|
||||
"data1": 10002,
|
||||
"data2": 0,
|
||||
"typtask_id": 4,
|
||||
"data1": 25001,
|
||||
"data2": 20,
|
||||
"data3": 0
|
||||
},
|
||||
{
|
||||
"rdtaks_num": 108,
|
||||
"typdes": 2,
|
||||
"datatime": 1,
|
||||
"typtask_id": 8,
|
||||
"typtask_id": 6,
|
||||
"data1": 90001,
|
||||
"data2": 15,
|
||||
"data2": 5,
|
||||
"data3": 0
|
||||
}
|
||||
]
|
@ -48,6 +48,7 @@ const (
|
||||
ModulePagoda core.M_Modules = "pagoda" //魔塔模块
|
||||
ModuleMartialhall core.M_Modules = "martialhall" //武馆模块
|
||||
ModuleGourmet core.M_Modules = "gourmet" //美食馆
|
||||
ModuleRtask core.M_Modules = "rtask" //随机任务
|
||||
)
|
||||
|
||||
//数据表名定义处
|
||||
@ -96,6 +97,8 @@ const (
|
||||
TableMartialhall = "martialhall"
|
||||
// 美食馆
|
||||
TableGourmet = "gourmet"
|
||||
// 随机任务
|
||||
TableRtask = "rtask"
|
||||
)
|
||||
|
||||
//RPC服务接口定义处
|
||||
@ -158,6 +161,7 @@ const (
|
||||
|
||||
type TaskType int32
|
||||
|
||||
// 日常任务事件类型
|
||||
const (
|
||||
TaskTypeUpEquip TaskType = 101 //任意装备升级
|
||||
TaskTypeUpHeroStar TaskType = 102 //获取星级英雄
|
||||
@ -174,6 +178,16 @@ const (
|
||||
TASK_STRATEGY TaskTag = 4 // 攻略
|
||||
)
|
||||
|
||||
// 随机任务类型
|
||||
const (
|
||||
RtaskTypeHeroTarget TaskType = 1 //英雄指定
|
||||
RtaskTypeHeroLvTarget TaskType = 2 //指定英雄的等级
|
||||
RtaskTypeEquipNum TaskType = 3 //装备数量
|
||||
RtaskTypePoltId TaskType = 4 //剧情ID
|
||||
RtaskTypeTaskDay TaskType = 5 //每日任务
|
||||
|
||||
)
|
||||
|
||||
const (
|
||||
MailLineEasy string = "mainline_data_easy" // 简单
|
||||
MailLineHard string = "mainline_data_hard" // 困难
|
||||
|
@ -102,6 +102,12 @@ type (
|
||||
CleanData(uid string)
|
||||
}
|
||||
|
||||
// 随机任务
|
||||
IRtask interface {
|
||||
//任务触发
|
||||
SendToRtask(session IUserSession, param *pb.RtaskParam) (code pb.ErrorCode)
|
||||
}
|
||||
|
||||
//好友
|
||||
IFriend interface {
|
||||
// 重置点赞列表和每日友情点
|
||||
|
29
modules/rtask/api.go
Normal file
29
modules/rtask/api.go
Normal file
@ -0,0 +1,29 @@
|
||||
package rtask
|
||||
|
||||
import (
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
)
|
||||
|
||||
const (
|
||||
RtaskSubTypeChoose = "choose" //选择
|
||||
)
|
||||
|
||||
type apiComp struct {
|
||||
modules.MCompGate
|
||||
service core.IService
|
||||
moduleRtask *ModuleRtask
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
err = this.MCompGate.Init(service, module, comp, options)
|
||||
this.moduleRtask = module.(*ModuleRtask)
|
||||
this.service = service
|
||||
return
|
||||
}
|
||||
|
||||
func (this *apiComp) Start() (err error) {
|
||||
err = this.MCompGate.Start()
|
||||
return
|
||||
}
|
56
modules/rtask/api_choose.go
Normal file
56
modules/rtask/api_choose.go
Normal file
@ -0,0 +1,56 @@
|
||||
package rtask
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/utils"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (this *apiComp) ChooseCheck(session comm.IUserSession, req *pb.RtaskChooseReq) (code pb.ErrorCode) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (this *apiComp) Choose(session comm.IUserSession, req *pb.RtaskChooseReq) (code pb.ErrorCode, data proto.Message) {
|
||||
if code = this.ChooseCheck(session, req); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
|
||||
rtask := &pb.DBRtask{}
|
||||
if err := this.moduleRtask.modelRtask.Get(session.GetUserId(), rtask); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 是否已完成
|
||||
if _, ok := utils.Findx(rtask.FrtaskIds, req.RtaskId); !ok {
|
||||
code = pb.ErrorCode_RtaskUnFinished
|
||||
return
|
||||
}
|
||||
|
||||
// 获取当前任务配置
|
||||
conf := this.moduleRtask.configure.getRtaskById(req.RtaskId)
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
|
||||
// var nextTaskId int32
|
||||
if req.ChooseId == 0 {
|
||||
//读任务配置中的next taskId
|
||||
// nextTaskId = conf.IdAfter
|
||||
} else {
|
||||
// nextTaskId =
|
||||
}
|
||||
|
||||
//发奖励
|
||||
code = this.moduleRtask.DispenseRes(session, conf.Reword, true)
|
||||
|
||||
rsp := &pb.RtaskChooseResp{}
|
||||
|
||||
if err := session.SendMsg(string(this.moduleRtask.GetType()), RtaskSubTypeChoose, rsp); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
}
|
||||
return
|
||||
}
|
116
modules/rtask/config.go
Normal file
116
modules/rtask/config.go
Normal file
@ -0,0 +1,116 @@
|
||||
package rtask
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
const (
|
||||
gameRtask = "game_rdtaskall.json"
|
||||
gameRtaskChoose = "rdtaskchoose.json"
|
||||
gameRtaskType = "rdtasktype.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{}{
|
||||
gameRtask: cfg.NewGameRdtaskAll,
|
||||
gameRtaskChoose: cfg.NewGameRdtaskChoose,
|
||||
gameRtaskType: cfg.NewGameRdtaskType,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) getRtaskCfg() (data *cfg.GameRdtaskAll, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(gameRtask); err != nil {
|
||||
return
|
||||
} else {
|
||||
if data, ok = v.(*cfg.GameRdtaskAll); !ok {
|
||||
err = fmt.Errorf("%T no is *cfg.GameRdtaskAll", v)
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) getRtaskTypeCfg() (data *cfg.GameRdtaskType, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(gameRtask); err != nil {
|
||||
return
|
||||
} else {
|
||||
if data, ok = v.(*cfg.GameRdtaskType); !ok {
|
||||
err = fmt.Errorf("%T is *cfg.GameRdtaskType", v)
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 获取随机任务配置
|
||||
func (this *configureComp) getRtaskList() (data []*cfg.GameRdtaskAllData, err error) {
|
||||
cfg, err := this.getRtaskCfg()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if cfg != nil {
|
||||
data = cfg.GetDataList()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 查询任务类型
|
||||
func (this *configureComp) getRtaskTypeById(typeId int32) (data *cfg.GameRdtaskTypeData, err error) {
|
||||
cfg, err := this.getRtaskTypeCfg()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if cfg != nil {
|
||||
if data, ok := cfg.GetDataMap()[typeId]; ok {
|
||||
return data, nil
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 任务
|
||||
func (this *configureComp) getRtaskById(taskId int32) (data *cfg.GameRdtaskAllData) {
|
||||
cfg, err := this.getRtaskCfg()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if cfg != nil {
|
||||
if data, ok := cfg.GetDataMap()[taskId]; ok {
|
||||
return data
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 首个任务
|
||||
func (this *configureComp) getFirstTask() *cfg.GameRdtaskAllData {
|
||||
cfg, err := this.getRtaskCfg()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
if cfg != nil {
|
||||
for _, v := range cfg.GetDataList() {
|
||||
if v.IdLast == 0 {
|
||||
return v
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
86
modules/rtask/model_rtask.go
Normal file
86
modules/rtask/model_rtask.go
Normal file
@ -0,0 +1,86 @@
|
||||
package rtask
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
type ModelRtask struct {
|
||||
modules.MCompModel
|
||||
moduleRtask *ModuleRtask
|
||||
}
|
||||
|
||||
func (this *ModelRtask) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
this.TableName = comm.TableRtask
|
||||
err = this.MCompModel.Init(service, module, comp, options)
|
||||
this.moduleRtask = module.(*ModuleRtask)
|
||||
return
|
||||
}
|
||||
|
||||
func (this *ModelRtask) setNextTask(uid string, rtaskId int32) error {
|
||||
update := map[string]interface{}{
|
||||
"nextRtaskId": rtaskId,
|
||||
}
|
||||
|
||||
return this.Change(uid, update)
|
||||
}
|
||||
|
||||
func (this *ModelRtask) doRtaskHandle(uid string, param *pb.RtaskParam) (rtaskId int32, err error) {
|
||||
log.Debugf("do rtask params: %v %v %v ", param.Param1, param.Param2, param.Param3)
|
||||
//查询玩家的
|
||||
rtask := &pb.DBRtask{}
|
||||
if err = this.Get(uid, rtask); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var taskId int32
|
||||
if len(rtask.FrtaskIds) == 0 {
|
||||
conf := this.moduleRtask.configure.getFirstTask()
|
||||
if conf != nil {
|
||||
taskId = conf.IdLast
|
||||
}
|
||||
} else {
|
||||
//TODO
|
||||
}
|
||||
|
||||
if rtask, ok := this.moduleRtask.rtaskHandleMap[taskId]; ok {
|
||||
for _, handle := range rtask.handlers {
|
||||
if ok := handle.fn(handle.cfg, param); !ok {
|
||||
log.Infof("uid: %v do rtask %v condition not", uid, taskId)
|
||||
break
|
||||
}
|
||||
}
|
||||
rtaskId = taskId
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// 1 英雄指定
|
||||
func (this *ModelRtask) HeroTarget(cfg *cfg.GameRdtaskTypeData, tp *pb.RtaskParam) (ok bool) {
|
||||
return cfg.Data1 == tp.Param1
|
||||
}
|
||||
|
||||
// 2 指定英雄的等级
|
||||
func (this *ModelRtask) HeroLvTarget(cfg *cfg.GameRdtaskTypeData, tp *pb.RtaskParam) (ok bool) {
|
||||
return cfg.Data1 == tp.Param1 && cfg.Data1 == tp.Param2
|
||||
}
|
||||
|
||||
// 3 指定英雄的指定装备的数量
|
||||
func (this *ModelRtask) EquipNum(cfg *cfg.GameRdtaskTypeData, tp *pb.RtaskParam) (ok bool) {
|
||||
return cfg.Data1 == tp.Param1 && cfg.Data2 == tp.Param2 && cfg.Data3 == tp.Param3
|
||||
}
|
||||
|
||||
// 4 剧情ID
|
||||
func (this *ModelRtask) PoltId(cfg *cfg.GameRdtaskTypeData, tp *pb.RtaskParam) (ok bool) {
|
||||
return cfg.Data1 == tp.Param1
|
||||
}
|
||||
|
||||
// 5 每日任务
|
||||
func (this *ModelRtask) TaskDay(cfg *cfg.GameRdtaskTypeData, tp *pb.RtaskParam) (ok bool) {
|
||||
return cfg.Data1 == tp.Param1
|
||||
}
|
131
modules/rtask/module.go
Normal file
131
modules/rtask/module.go
Normal file
@ -0,0 +1,131 @@
|
||||
// package 随机任务
|
||||
package rtask
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
// 随机任务
|
||||
type rtask struct {
|
||||
rtaskId int32
|
||||
handlers []*rtaskCondi
|
||||
}
|
||||
|
||||
// 限定条件
|
||||
type rtaskCondi struct {
|
||||
cfg *cfg.GameRdtaskTypeData
|
||||
fn rtaskHandle
|
||||
}
|
||||
|
||||
// 设定返回值
|
||||
type rtaskHandle func(cfg *cfg.GameRdtaskTypeData, tp *pb.RtaskParam) (ok bool)
|
||||
|
||||
type ModuleRtask struct {
|
||||
modules.ModuleBase
|
||||
modelRtask *ModelRtask
|
||||
api *apiComp
|
||||
configure *configureComp
|
||||
|
||||
rtaskHandleMap map[int32]*rtask // 任务处理器
|
||||
}
|
||||
|
||||
func NewModule() core.IModule {
|
||||
return &ModuleRtask{
|
||||
rtaskHandleMap: make(map[int32]*rtask),
|
||||
}
|
||||
}
|
||||
|
||||
func (this *ModuleRtask) GetType() core.M_Modules {
|
||||
return comm.ModuleRtask
|
||||
}
|
||||
|
||||
func (this *ModuleRtask) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
err = this.ModuleBase.Init(service, module, options)
|
||||
this.initRtaskHandle()
|
||||
return
|
||||
}
|
||||
|
||||
func (this *ModuleRtask) OnInstallComp() {
|
||||
this.ModuleBase.OnInstallComp()
|
||||
|
||||
}
|
||||
|
||||
func (this *ModuleRtask) register(rtaskId int32, rtask *rtask) {
|
||||
if _, ok := this.rtaskHandleMap[rtaskId]; !ok {
|
||||
this.rtaskHandleMap[rtaskId] = rtask
|
||||
}
|
||||
}
|
||||
|
||||
func (this *ModuleRtask) initRtaskHandle() {
|
||||
if data, err := this.configure.getRtaskList(); err == nil {
|
||||
for _, v := range data {
|
||||
var handlers []*rtaskCondi
|
||||
rtask := &rtask{
|
||||
rtaskId: v.RdtaksId,
|
||||
handlers: handlers,
|
||||
}
|
||||
|
||||
//遍历任务的限定条件
|
||||
for _, rtaskTypeId := range v.RdtaksNum {
|
||||
// 获取每个限定条件配置
|
||||
if typeCfg, err2 := this.configure.getRtaskTypeById(rtaskTypeId); err2 == nil {
|
||||
if typeCfg != nil {
|
||||
switch comm.TaskType(typeCfg.GetTypeId()) {
|
||||
case comm.RtaskTypeHeroTarget:
|
||||
handlers = append(handlers, &rtaskCondi{
|
||||
cfg: typeCfg,
|
||||
fn: this.modelRtask.HeroTarget,
|
||||
})
|
||||
case comm.RtaskTypeHeroLvTarget:
|
||||
handlers = append(handlers, &rtaskCondi{
|
||||
cfg: typeCfg,
|
||||
fn: this.modelRtask.HeroLvTarget,
|
||||
})
|
||||
case comm.RtaskTypeEquipNum:
|
||||
handlers = append(handlers, &rtaskCondi{
|
||||
cfg: typeCfg,
|
||||
fn: this.modelRtask.EquipNum,
|
||||
})
|
||||
case comm.RtaskTypePoltId:
|
||||
handlers = append(handlers, &rtaskCondi{
|
||||
cfg: typeCfg,
|
||||
fn: this.modelRtask.PoltId,
|
||||
})
|
||||
case comm.RtaskTypeTaskDay:
|
||||
handlers = append(handlers, &rtaskCondi{
|
||||
cfg: typeCfg,
|
||||
fn: this.modelRtask.TaskDay,
|
||||
})
|
||||
|
||||
default:
|
||||
log.Warnf("%v rtask type not configure", typeCfg.GetTypeId())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.register(v.RdtaksId, rtask)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 通知随机任务
|
||||
func (this *ModuleRtask) SendToRtask(session comm.IUserSession, param *pb.RtaskParam) (code pb.ErrorCode) {
|
||||
if taskId, err := this.modelRtask.doRtaskHandle(session.GetUserId(), param); err != nil {
|
||||
code = pb.ErrorCode_TaskHandle
|
||||
} else {
|
||||
if err := session.SendMsg(string(comm.ModuleRtask), "", &pb.RtaskFinishPush{
|
||||
RtaskId: taskId,
|
||||
}); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
115
pb/comm.pb.go
115
pb/comm.pb.go
@ -957,6 +957,69 @@ func (x *TaskParam) GetSecond() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
type RtaskParam struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Param1 int32 `protobuf:"varint,1,opt,name=param1,proto3" json:"param1"`
|
||||
Param2 int32 `protobuf:"varint,2,opt,name=param2,proto3" json:"param2"`
|
||||
Param3 int32 `protobuf:"varint,3,opt,name=param3,proto3" json:"param3"`
|
||||
}
|
||||
|
||||
func (x *RtaskParam) Reset() {
|
||||
*x = RtaskParam{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_comm_proto_msgTypes[13]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RtaskParam) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RtaskParam) ProtoMessage() {}
|
||||
|
||||
func (x *RtaskParam) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_comm_proto_msgTypes[13]
|
||||
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 RtaskParam.ProtoReflect.Descriptor instead.
|
||||
func (*RtaskParam) Descriptor() ([]byte, []int) {
|
||||
return file_comm_proto_rawDescGZIP(), []int{13}
|
||||
}
|
||||
|
||||
func (x *RtaskParam) GetParam1() int32 {
|
||||
if x != nil {
|
||||
return x.Param1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RtaskParam) GetParam2() int32 {
|
||||
if x != nil {
|
||||
return x.Param2
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RtaskParam) GetParam3() int32 {
|
||||
if x != nil {
|
||||
return x.Param3
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_comm_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_comm_proto_rawDesc = []byte{
|
||||
@ -1065,13 +1128,18 @@ var file_comm_proto_rawDesc = []byte{
|
||||
0x05, 0x52, 0x01, 0x4e, 0x22, 0x39, 0x0a, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x50, 0x61, 0x72, 0x61,
|
||||
0x6d, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x69, 0x72, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x05, 0x66, 0x69, 0x72, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x6f, 0x6e,
|
||||
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x2a,
|
||||
0x43, 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65,
|
||||
0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x48, 0x70, 0x10, 0x00, 0x12, 0x07, 0x0a,
|
||||
0x03, 0x41, 0x74, 0x6b, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x65, 0x66, 0x10, 0x02, 0x12,
|
||||
0x09, 0x0a, 0x05, 0x53, 0x70, 0x65, 0x65, 0x64, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x72,
|
||||
0x69, 0x74, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x22,
|
||||
0x54, 0x0a, 0x0a, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x16, 0x0a,
|
||||
0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x70,
|
||||
0x61, 0x72, 0x61, 0x6d, 0x31, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x32, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x32, 0x12, 0x16, 0x0a,
|
||||
0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x33, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x70,
|
||||
0x61, 0x72, 0x61, 0x6d, 0x33, 0x2a, 0x43, 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, 0x41, 0x74, 0x74,
|
||||
0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x48,
|
||||
0x70, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x74, 0x6b, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03,
|
||||
0x44, 0x65, 0x66, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x70, 0x65, 0x65, 0x64, 0x10, 0x03,
|
||||
0x12, 0x08, 0x0a, 0x04, 0x43, 0x72, 0x69, 0x74, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
|
||||
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -1087,7 +1155,7 @@ func file_comm_proto_rawDescGZIP() []byte {
|
||||
}
|
||||
|
||||
var file_comm_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_comm_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
|
||||
var file_comm_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
|
||||
var file_comm_proto_goTypes = []interface{}{
|
||||
(HeroAttributesType)(0), // 0: HeroAttributesType
|
||||
(*UserMessage)(nil), // 1: UserMessage
|
||||
@ -1103,18 +1171,19 @@ var file_comm_proto_goTypes = []interface{}{
|
||||
(*NoticeUserCloseReq)(nil), // 11: NoticeUserCloseReq
|
||||
(*UserAssets)(nil), // 12: UserAssets
|
||||
(*TaskParam)(nil), // 13: TaskParam
|
||||
(*anypb.Any)(nil), // 14: google.protobuf.Any
|
||||
(ErrorCode)(0), // 15: ErrorCode
|
||||
(*RtaskParam)(nil), // 14: RtaskParam
|
||||
(*anypb.Any)(nil), // 15: google.protobuf.Any
|
||||
(ErrorCode)(0), // 16: ErrorCode
|
||||
}
|
||||
var file_comm_proto_depIdxs = []int32{
|
||||
14, // 0: UserMessage.data:type_name -> google.protobuf.Any
|
||||
14, // 1: AgentMessage.Message:type_name -> google.protobuf.Any
|
||||
15, // 2: RPCMessageReply.Code:type_name -> ErrorCode
|
||||
14, // 3: RPCMessageReply.ErrorData:type_name -> google.protobuf.Any
|
||||
15, // 0: UserMessage.data:type_name -> google.protobuf.Any
|
||||
15, // 1: AgentMessage.Message:type_name -> google.protobuf.Any
|
||||
16, // 2: RPCMessageReply.Code:type_name -> ErrorCode
|
||||
15, // 3: RPCMessageReply.ErrorData:type_name -> google.protobuf.Any
|
||||
1, // 4: RPCMessageReply.Reply:type_name -> UserMessage
|
||||
1, // 5: AgentSendMessageReq.Reply:type_name -> UserMessage
|
||||
14, // 6: BatchMessageReq.Data:type_name -> google.protobuf.Any
|
||||
14, // 7: BroadCastMessageReq.Data:type_name -> google.protobuf.Any
|
||||
15, // 6: BatchMessageReq.Data:type_name -> google.protobuf.Any
|
||||
15, // 7: BroadCastMessageReq.Data:type_name -> google.protobuf.Any
|
||||
8, // [8:8] is the sub-list for method output_type
|
||||
8, // [8:8] is the sub-list for method input_type
|
||||
8, // [8:8] is the sub-list for extension type_name
|
||||
@ -1285,6 +1354,18 @@ func file_comm_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_comm_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RtaskParam); 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{
|
||||
@ -1292,7 +1373,7 @@ func file_comm_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_comm_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 13,
|
||||
NumMessages: 14,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
@ -149,6 +149,9 @@ const (
|
||||
// 美食馆
|
||||
ErrorCode_GourmetMoreOrderTime ErrorCode = 2101 // 超过订单时长
|
||||
ErrorCode_GourmetSkillMaxLv ErrorCode = 2102 // 技能已经达到满级
|
||||
// rtask
|
||||
ErrorCode_RtaskFinished ErrorCode = 2201 //任务已完成
|
||||
ErrorCode_RtaskUnFinished ErrorCode = 2202 //任务未完成
|
||||
)
|
||||
|
||||
// Enum value maps for ErrorCode.
|
||||
@ -268,6 +271,8 @@ var (
|
||||
2002: "MartialhallUnlocked",
|
||||
2101: "GourmetMoreOrderTime",
|
||||
2102: "GourmetSkillMaxLv",
|
||||
2201: "RtaskFinished",
|
||||
2202: "RtaskUnFinished",
|
||||
}
|
||||
ErrorCode_value = map[string]int32{
|
||||
"Success": 0,
|
||||
@ -384,6 +389,8 @@ var (
|
||||
"MartialhallUnlocked": 2002,
|
||||
"GourmetMoreOrderTime": 2101,
|
||||
"GourmetSkillMaxLv": 2102,
|
||||
"RtaskFinished": 2201,
|
||||
"RtaskUnFinished": 2202,
|
||||
}
|
||||
)
|
||||
|
||||
@ -418,7 +425,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, 0x8c, 0x13, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||
0x6f, 0x2a, 0xb6, 0x13, 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,
|
||||
@ -571,7 +578,10 @@ var file_errorcode_proto_rawDesc = []byte{
|
||||
0x14, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x4d, 0x6f, 0x72, 0x65, 0x4f, 0x72, 0x64, 0x65,
|
||||
0x72, 0x54, 0x69, 0x6d, 0x65, 0x10, 0xb5, 0x10, 0x12, 0x16, 0x0a, 0x11, 0x47, 0x6f, 0x75, 0x72,
|
||||
0x6d, 0x65, 0x74, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x4c, 0x76, 0x10, 0xb6, 0x10,
|
||||
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x12, 0x12, 0x0a, 0x0d, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65,
|
||||
0x64, 0x10, 0x99, 0x11, 0x12, 0x14, 0x0a, 0x0f, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x55, 0x6e, 0x46,
|
||||
0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0x9a, 0x11, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
|
||||
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
File diff suppressed because it is too large
Load Diff
170
pb/rtask_db.pb.go
Normal file
170
pb/rtask_db.pb.go
Normal file
@ -0,0 +1,170 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.0
|
||||
// protoc v3.20.0
|
||||
// source: rtask/rtask_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 DBRtask 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
|
||||
FrtaskIds []int32 `protobuf:"varint,3,rep,packed,name=frtaskIds,proto3" json:"frtaskIds" bson:"frtaskIds"` //已完成的任务Id
|
||||
NextRtaskId int32 `protobuf:"varint,4,opt,name=nextRtaskId,proto3" json:"nextRtaskId"` //@go_tags(`bson:"nextRtaskId"`)下个任务Id
|
||||
}
|
||||
|
||||
func (x *DBRtask) Reset() {
|
||||
*x = DBRtask{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_rtask_rtask_db_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DBRtask) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DBRtask) ProtoMessage() {}
|
||||
|
||||
func (x *DBRtask) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rtask_rtask_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 DBRtask.ProtoReflect.Descriptor instead.
|
||||
func (*DBRtask) Descriptor() ([]byte, []int) {
|
||||
return file_rtask_rtask_db_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *DBRtask) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DBRtask) GetUid() string {
|
||||
if x != nil {
|
||||
return x.Uid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DBRtask) GetFrtaskIds() []int32 {
|
||||
if x != nil {
|
||||
return x.FrtaskIds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DBRtask) GetNextRtaskId() int32 {
|
||||
if x != nil {
|
||||
return x.NextRtaskId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_rtask_rtask_db_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_rtask_rtask_db_proto_rawDesc = []byte{
|
||||
0x0a, 0x14, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x2f, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x64, 0x62,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6b, 0x0a, 0x07, 0x44, 0x42, 0x52, 0x74, 0x61, 0x73,
|
||||
0x6b, 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, 0x1c, 0x0a, 0x09, 0x66, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73,
|
||||
0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x09, 0x66, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64,
|
||||
0x73, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x65, 0x78, 0x74, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6e, 0x65, 0x78, 0x74, 0x52, 0x74, 0x61, 0x73,
|
||||
0x6b, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_rtask_rtask_db_proto_rawDescOnce sync.Once
|
||||
file_rtask_rtask_db_proto_rawDescData = file_rtask_rtask_db_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_rtask_rtask_db_proto_rawDescGZIP() []byte {
|
||||
file_rtask_rtask_db_proto_rawDescOnce.Do(func() {
|
||||
file_rtask_rtask_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_rtask_rtask_db_proto_rawDescData)
|
||||
})
|
||||
return file_rtask_rtask_db_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_rtask_rtask_db_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_rtask_rtask_db_proto_goTypes = []interface{}{
|
||||
(*DBRtask)(nil), // 0: DBRtask
|
||||
}
|
||||
var file_rtask_rtask_db_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_rtask_rtask_db_proto_init() }
|
||||
func file_rtask_rtask_db_proto_init() {
|
||||
if File_rtask_rtask_db_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_rtask_rtask_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DBRtask); 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_rtask_rtask_db_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_rtask_rtask_db_proto_goTypes,
|
||||
DependencyIndexes: file_rtask_rtask_db_proto_depIdxs,
|
||||
MessageInfos: file_rtask_rtask_db_proto_msgTypes,
|
||||
}.Build()
|
||||
File_rtask_rtask_db_proto = out.File
|
||||
file_rtask_rtask_db_proto_rawDesc = nil
|
||||
file_rtask_rtask_db_proto_goTypes = nil
|
||||
file_rtask_rtask_db_proto_depIdxs = nil
|
||||
}
|
268
pb/rtask_msg.pb.go
Normal file
268
pb/rtask_msg.pb.go
Normal file
@ -0,0 +1,268 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.0
|
||||
// protoc v3.20.0
|
||||
// source: rtask/rtask_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 RtaskChooseReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
RtaskId int32 `protobuf:"varint,1,opt,name=rtaskId,proto3" json:"rtaskId"`
|
||||
ChooseId int32 `protobuf:"varint,2,opt,name=chooseId,proto3" json:"chooseId"`
|
||||
}
|
||||
|
||||
func (x *RtaskChooseReq) Reset() {
|
||||
*x = RtaskChooseReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_rtask_rtask_msg_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RtaskChooseReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RtaskChooseReq) ProtoMessage() {}
|
||||
|
||||
func (x *RtaskChooseReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rtask_rtask_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 RtaskChooseReq.ProtoReflect.Descriptor instead.
|
||||
func (*RtaskChooseReq) Descriptor() ([]byte, []int) {
|
||||
return file_rtask_rtask_msg_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *RtaskChooseReq) GetRtaskId() int32 {
|
||||
if x != nil {
|
||||
return x.RtaskId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RtaskChooseReq) GetChooseId() int32 {
|
||||
if x != nil {
|
||||
return x.ChooseId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type RtaskChooseResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *RtaskChooseResp) Reset() {
|
||||
*x = RtaskChooseResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_rtask_rtask_msg_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RtaskChooseResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RtaskChooseResp) ProtoMessage() {}
|
||||
|
||||
func (x *RtaskChooseResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rtask_rtask_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 RtaskChooseResp.ProtoReflect.Descriptor instead.
|
||||
func (*RtaskChooseResp) Descriptor() ([]byte, []int) {
|
||||
return file_rtask_rtask_msg_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
// 任务完成推送
|
||||
type RtaskFinishPush struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
RtaskId int32 `protobuf:"varint,1,opt,name=rtaskId,proto3" json:"rtaskId"`
|
||||
}
|
||||
|
||||
func (x *RtaskFinishPush) Reset() {
|
||||
*x = RtaskFinishPush{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_rtask_rtask_msg_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RtaskFinishPush) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RtaskFinishPush) ProtoMessage() {}
|
||||
|
||||
func (x *RtaskFinishPush) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rtask_rtask_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 RtaskFinishPush.ProtoReflect.Descriptor instead.
|
||||
func (*RtaskFinishPush) Descriptor() ([]byte, []int) {
|
||||
return file_rtask_rtask_msg_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *RtaskFinishPush) GetRtaskId() int32 {
|
||||
if x != nil {
|
||||
return x.RtaskId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_rtask_rtask_msg_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_rtask_rtask_msg_proto_rawDesc = []byte{
|
||||
0x0a, 0x15, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x2f, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x6d, 0x73,
|
||||
0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x46, 0x0a, 0x0e, 0x52, 0x74, 0x61, 0x73, 0x6b,
|
||||
0x43, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61,
|
||||
0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73,
|
||||
0x6b, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x22,
|
||||
0x11, 0x0a, 0x0f, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x52, 0x65,
|
||||
0x73, 0x70, 0x22, 0x2b, 0x0a, 0x0f, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73,
|
||||
0x68, 0x50, 0x75, 0x73, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x42,
|
||||
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_rtask_rtask_msg_proto_rawDescOnce sync.Once
|
||||
file_rtask_rtask_msg_proto_rawDescData = file_rtask_rtask_msg_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_rtask_rtask_msg_proto_rawDescGZIP() []byte {
|
||||
file_rtask_rtask_msg_proto_rawDescOnce.Do(func() {
|
||||
file_rtask_rtask_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_rtask_rtask_msg_proto_rawDescData)
|
||||
})
|
||||
return file_rtask_rtask_msg_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_rtask_rtask_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_rtask_rtask_msg_proto_goTypes = []interface{}{
|
||||
(*RtaskChooseReq)(nil), // 0: RtaskChooseReq
|
||||
(*RtaskChooseResp)(nil), // 1: RtaskChooseResp
|
||||
(*RtaskFinishPush)(nil), // 2: RtaskFinishPush
|
||||
}
|
||||
var file_rtask_rtask_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_rtask_rtask_msg_proto_init() }
|
||||
func file_rtask_rtask_msg_proto_init() {
|
||||
if File_rtask_rtask_msg_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_rtask_rtask_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RtaskChooseReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_rtask_rtask_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RtaskChooseResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_rtask_rtask_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RtaskFinishPush); 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_rtask_rtask_msg_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_rtask_rtask_msg_proto_goTypes,
|
||||
DependencyIndexes: file_rtask_rtask_msg_proto_depIdxs,
|
||||
MessageInfos: file_rtask_rtask_msg_proto_msgTypes,
|
||||
}.Build()
|
||||
File_rtask_rtask_msg_proto = out.File
|
||||
file_rtask_rtask_msg_proto_rawDesc = nil
|
||||
file_rtask_rtask_msg_proto_goTypes = nil
|
||||
file_rtask_rtask_msg_proto_depIdxs = nil
|
||||
}
|
@ -16,6 +16,7 @@ import (
|
||||
"go_dreamfactory/modules/martialhall"
|
||||
"go_dreamfactory/modules/notify"
|
||||
"go_dreamfactory/modules/pagoda"
|
||||
"go_dreamfactory/modules/rtask"
|
||||
"go_dreamfactory/modules/shop"
|
||||
"go_dreamfactory/modules/task"
|
||||
"go_dreamfactory/modules/user"
|
||||
@ -63,6 +64,7 @@ func main() {
|
||||
pagoda.NewModule(),
|
||||
gourmet.NewModule(),
|
||||
martialhall.NewModule(),
|
||||
rtask.NewModule(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,6 @@ package cfg
|
||||
type JsonLoader func(string) ([]map[string]interface{}, error)
|
||||
|
||||
type Tables struct {
|
||||
LocalizeConfig_CNCategory *LocalizeLocalizeConfig_CNCategory
|
||||
LocalizeConfig_ENCategory *LocalizeLocalizeConfig_ENCategory
|
||||
LocalizeConfig_TWCategory *LocalizeLocalizeConfig_TWCategory
|
||||
global *Gameglobal
|
||||
ui *Gameui
|
||||
plot *Gameplot
|
||||
@ -70,6 +67,14 @@ type Tables struct {
|
||||
pagoda *Gamepagoda
|
||||
pagodaTaskReward *GamepagodaTaskReward
|
||||
pagodaSeasonReward *GamepagodaSeasonReward
|
||||
pagodaseasonLoop *GamepagodaseasonLoop
|
||||
rdtaskAll *GamerdtaskAll
|
||||
rdtaskType *GamerdtaskType
|
||||
rdtaskChoose *GamerdtaskChoose
|
||||
kungfu_unlock *Gamekungfu_unlock
|
||||
kungfu_masterworker *Gamekungfu_masterworker
|
||||
Gourmet *GameGourmet
|
||||
GourmetSkill *GameGourmetSkill
|
||||
}
|
||||
|
||||
func NewTables(loader JsonLoader) (*Tables, error) {
|
||||
@ -77,24 +82,6 @@ func NewTables(loader JsonLoader) (*Tables, error) {
|
||||
var buf []map[string]interface{}
|
||||
|
||||
tables := &Tables{}
|
||||
if buf, err = loader("LocalizeConfig_CN") ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tables.LocalizeConfig_CNCategory, err = NewLocalizeLocalizeConfig_CNCategory(buf) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf, err = loader("LocalizeConfig_EN") ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tables.LocalizeConfig_ENCategory, err = NewLocalizeLocalizeConfig_ENCategory(buf) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf, err = loader("LocalizeConfig_TW") ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tables.LocalizeConfig_TWCategory, err = NewLocalizeLocalizeConfig_TWCategory(buf) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf, err = loader("game_global") ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -431,5 +418,53 @@ func NewTables(loader JsonLoader) (*Tables, error) {
|
||||
if tables.pagodaSeasonReward, err = NewGamepagodaSeasonReward(buf) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf, err = loader("game_pagodaseasonloop") ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tables.pagodaseasonLoop, err = NewGamepagodaseasonLoop(buf) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf, err = loader("game_rdtaskall") ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tables.rdtaskAll, err = NewGamerdtaskAll(buf) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf, err = loader("game_rdtasktype") ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tables.rdtaskType, err = NewGamerdtaskType(buf) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf, err = loader("game_rdtaskchoose") ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tables.rdtaskChoose, err = NewGamerdtaskChoose(buf) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf, err = loader("game_kungfu_unlock") ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tables.kungfu_unlock, err = NewGamekungfu_unlock(buf) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf, err = loader("game_kungfu_masterworker") ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tables.kungfu_masterworker, err = NewGamekungfu_masterworker(buf) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf, err = loader("game_gourmet") ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tables.Gourmet, err = NewGameGourmet(buf) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf, err = loader("game_gourmetskill") ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tables.GourmetSkill, err = NewGameGourmetSkill(buf) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return tables, nil
|
||||
}
|
||||
|
42
sys/configure/structs/game.rdtaskAll.go
Normal file
42
sys/configure/structs/game.rdtaskAll.go
Normal 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 GamerdtaskAll struct {
|
||||
_dataMap map[int32]*GamerdtaskAllData
|
||||
_dataList []*GamerdtaskAllData
|
||||
}
|
||||
|
||||
func NewGamerdtaskAll(_buf []map[string]interface{}) (*GamerdtaskAll, error) {
|
||||
_dataList := make([]*GamerdtaskAllData, 0, len(_buf))
|
||||
dataMap := make(map[int32]*GamerdtaskAllData)
|
||||
for _, _ele_ := range _buf {
|
||||
if _v, err2 := DeserializeGamerdtaskAllData(_ele_); err2 != nil {
|
||||
return nil, err2
|
||||
} else {
|
||||
_dataList = append(_dataList, _v)
|
||||
dataMap[_v.Id] = _v
|
||||
}
|
||||
}
|
||||
return &GamerdtaskAll{_dataList:_dataList, _dataMap:dataMap}, nil
|
||||
}
|
||||
|
||||
func (table *GamerdtaskAll) GetDataMap() map[int32]*GamerdtaskAllData {
|
||||
return table._dataMap
|
||||
}
|
||||
|
||||
func (table *GamerdtaskAll) GetDataList() []*GamerdtaskAllData {
|
||||
return table._dataList
|
||||
}
|
||||
|
||||
func (table *GamerdtaskAll) Get(key int32) *GamerdtaskAllData {
|
||||
return table._dataMap[key]
|
||||
}
|
||||
|
||||
|
94
sys/configure/structs/game.rdtaskAllData.go
Normal file
94
sys/configure/structs/game.rdtaskAllData.go
Normal file
@ -0,0 +1,94 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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 GamerdtaskAllData struct {
|
||||
Id int32
|
||||
Type int32
|
||||
Lastend int32
|
||||
RdtaksNum []int32
|
||||
Aftertaks int32
|
||||
Icetime int32
|
||||
Tag int32
|
||||
Story int32
|
||||
Completetask int32
|
||||
Chooseid []int32
|
||||
Reword []*Gameatn
|
||||
}
|
||||
|
||||
const TypeId_GamerdtaskAllData = 762735928
|
||||
|
||||
func (*GamerdtaskAllData) GetTypeId() int32 {
|
||||
return 762735928
|
||||
}
|
||||
|
||||
func (_v *GamerdtaskAllData)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["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lastend"].(float64); !_ok_ { err = errors.New("lastend error"); return }; _v.Lastend = int32(_tempNum_) }
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["rdtaks_num"].([]interface{}); !_ok_ { err = errors.New("rdtaks_num error"); return }
|
||||
|
||||
_v.RdtaksNum = 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.RdtaksNum = append(_v.RdtaksNum, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["aftertaks"].(float64); !_ok_ { err = errors.New("aftertaks error"); return }; _v.Aftertaks = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["icetime"].(float64); !_ok_ { err = errors.New("icetime error"); return }; _v.Icetime = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["tag"].(float64); !_ok_ { err = errors.New("tag error"); return }; _v.Tag = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["story"].(float64); !_ok_ { err = errors.New("story error"); return }; _v.Story = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["completetask"].(float64); !_ok_ { err = errors.New("completetask error"); return }; _v.Completetask = int32(_tempNum_) }
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["chooseid"].([]interface{}); !_ok_ { err = errors.New("chooseid error"); return }
|
||||
|
||||
_v.Chooseid = 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.Chooseid = append(_v.Chooseid, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["reword"].([]interface{}); !_ok_ { err = errors.New("reword error"); return }
|
||||
|
||||
_v.Reword = 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.Reword = append(_v.Reword, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func DeserializeGamerdtaskAllData(_buf map[string]interface{}) (*GamerdtaskAllData, error) {
|
||||
v := &GamerdtaskAllData{}
|
||||
if err := v.Deserialize(_buf); err == nil {
|
||||
return v, nil
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
42
sys/configure/structs/game.rdtaskChoose.go
Normal file
42
sys/configure/structs/game.rdtaskChoose.go
Normal 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 GamerdtaskChoose struct {
|
||||
_dataMap map[int32]*GamerdtaskChooseData
|
||||
_dataList []*GamerdtaskChooseData
|
||||
}
|
||||
|
||||
func NewGamerdtaskChoose(_buf []map[string]interface{}) (*GamerdtaskChoose, error) {
|
||||
_dataList := make([]*GamerdtaskChooseData, 0, len(_buf))
|
||||
dataMap := make(map[int32]*GamerdtaskChooseData)
|
||||
for _, _ele_ := range _buf {
|
||||
if _v, err2 := DeserializeGamerdtaskChooseData(_ele_); err2 != nil {
|
||||
return nil, err2
|
||||
} else {
|
||||
_dataList = append(_dataList, _v)
|
||||
dataMap[_v.Chooseid] = _v
|
||||
}
|
||||
}
|
||||
return &GamerdtaskChoose{_dataList:_dataList, _dataMap:dataMap}, nil
|
||||
}
|
||||
|
||||
func (table *GamerdtaskChoose) GetDataMap() map[int32]*GamerdtaskChooseData {
|
||||
return table._dataMap
|
||||
}
|
||||
|
||||
func (table *GamerdtaskChoose) GetDataList() []*GamerdtaskChooseData {
|
||||
return table._dataList
|
||||
}
|
||||
|
||||
func (table *GamerdtaskChoose) Get(key int32) *GamerdtaskChooseData {
|
||||
return table._dataMap[key]
|
||||
}
|
||||
|
||||
|
54
sys/configure/structs/game.rdtaskChooseData.go
Normal file
54
sys/configure/structs/game.rdtaskChooseData.go
Normal file
@ -0,0 +1,54 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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 GamerdtaskChooseData struct {
|
||||
Chooseid int32
|
||||
Num int32
|
||||
RdtaksNum int32
|
||||
Need []int32
|
||||
}
|
||||
|
||||
const TypeId_GamerdtaskChooseData = 1478012660
|
||||
|
||||
func (*GamerdtaskChooseData) GetTypeId() int32 {
|
||||
return 1478012660
|
||||
}
|
||||
|
||||
func (_v *GamerdtaskChooseData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["chooseid"].(float64); !_ok_ { err = errors.New("chooseid error"); return }; _v.Chooseid = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["num"].(float64); !_ok_ { err = errors.New("num error"); return }; _v.Num = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["rdtaks_num"].(float64); !_ok_ { err = errors.New("rdtaks_num error"); return }; _v.RdtaksNum = int32(_tempNum_) }
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["need"].([]interface{}); !_ok_ { err = errors.New("need error"); return }
|
||||
|
||||
_v.Need = 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.Need = append(_v.Need, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func DeserializeGamerdtaskChooseData(_buf map[string]interface{}) (*GamerdtaskChooseData, error) {
|
||||
v := &GamerdtaskChooseData{}
|
||||
if err := v.Deserialize(_buf); err == nil {
|
||||
return v, nil
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
42
sys/configure/structs/game.rdtaskType.go
Normal file
42
sys/configure/structs/game.rdtaskType.go
Normal 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 GamerdtaskType struct {
|
||||
_dataMap map[int32]*GamerdtaskTypeData
|
||||
_dataList []*GamerdtaskTypeData
|
||||
}
|
||||
|
||||
func NewGamerdtaskType(_buf []map[string]interface{}) (*GamerdtaskType, error) {
|
||||
_dataList := make([]*GamerdtaskTypeData, 0, len(_buf))
|
||||
dataMap := make(map[int32]*GamerdtaskTypeData)
|
||||
for _, _ele_ := range _buf {
|
||||
if _v, err2 := DeserializeGamerdtaskTypeData(_ele_); err2 != nil {
|
||||
return nil, err2
|
||||
} else {
|
||||
_dataList = append(_dataList, _v)
|
||||
dataMap[_v.RdtaksNum] = _v
|
||||
}
|
||||
}
|
||||
return &GamerdtaskType{_dataList:_dataList, _dataMap:dataMap}, nil
|
||||
}
|
||||
|
||||
func (table *GamerdtaskType) GetDataMap() map[int32]*GamerdtaskTypeData {
|
||||
return table._dataMap
|
||||
}
|
||||
|
||||
func (table *GamerdtaskType) GetDataList() []*GamerdtaskTypeData {
|
||||
return table._dataList
|
||||
}
|
||||
|
||||
func (table *GamerdtaskType) Get(key int32) *GamerdtaskTypeData {
|
||||
return table._dataMap[key]
|
||||
}
|
||||
|
||||
|
47
sys/configure/structs/game.rdtaskTypeData.go
Normal file
47
sys/configure/structs/game.rdtaskTypeData.go
Normal file
@ -0,0 +1,47 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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 GamerdtaskTypeData struct {
|
||||
RdtaksNum int32
|
||||
Typdes int32
|
||||
Datatime int32
|
||||
TyptaskId int32
|
||||
Data1 int32
|
||||
Data2 int32
|
||||
Data3 int32
|
||||
}
|
||||
|
||||
const TypeId_GamerdtaskTypeData = -279607465
|
||||
|
||||
func (*GamerdtaskTypeData) GetTypeId() int32 {
|
||||
return -279607465
|
||||
}
|
||||
|
||||
func (_v *GamerdtaskTypeData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["rdtaks_num"].(float64); !_ok_ { err = errors.New("rdtaks_num error"); return }; _v.RdtaksNum = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["typdes"].(float64); !_ok_ { err = errors.New("typdes error"); return }; _v.Typdes = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["datatime"].(float64); !_ok_ { err = errors.New("datatime error"); return }; _v.Datatime = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["typtask_id"].(float64); !_ok_ { err = errors.New("typtask_id error"); return }; _v.TyptaskId = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["data1"].(float64); !_ok_ { err = errors.New("data1 error"); return }; _v.Data1 = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["data2"].(float64); !_ok_ { err = errors.New("data2 error"); return }; _v.Data2 = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["data3"].(float64); !_ok_ { err = errors.New("data3 error"); return }; _v.Data3 = int32(_tempNum_) }
|
||||
return
|
||||
}
|
||||
|
||||
func DeserializeGamerdtaskTypeData(_buf map[string]interface{}) (*GamerdtaskTypeData, error) {
|
||||
v := &GamerdtaskTypeData{}
|
||||
if err := v.Deserialize(_buf); err == nil {
|
||||
return v, nil
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
@ -20,6 +20,16 @@ func UIdSplit(uid string) (string, string, bool) {
|
||||
return s[0], s[1], true
|
||||
}
|
||||
|
||||
func Findx[T string | int32](slice []T, val T) (int, bool) {
|
||||
for i, item := range slice {
|
||||
if item == val {
|
||||
return i, true
|
||||
}
|
||||
}
|
||||
return -1, false
|
||||
}
|
||||
|
||||
// Deprecated: Use Findx instead
|
||||
func Find(slice []string, val string) (int, bool) {
|
||||
for i, item := range slice {
|
||||
if item == val {
|
||||
|
Loading…
Reference in New Issue
Block a user