This commit is contained in:
meixiongfeng 2023-05-25 15:00:38 +08:00
commit 8c22d48913
19 changed files with 866 additions and 344 deletions

View File

@ -0,0 +1,22 @@
[
{
"id": 101,
"rtype": 2,
"type_sp": 0,
"tasktxt": {
"key": "Localize_Localize_Program_tasktxt_1",
"text": ""
},
"type": 1,
"valid": 0,
"NPC": 0,
"vtype": 1,
"value": 1,
"filter": [
{
"s": "eq",
"d": 25001
}
]
}
]

View File

@ -367,8 +367,8 @@
"type": 22,
"valid": 0,
"NPC": 0,
"data1": 25001,
"data2": 0,
"data1": 1,
"data2": 25001,
"data3": 0,
"data4": 0,
"data5": 0
@ -487,8 +487,8 @@
"valid": 0,
"NPC": 0,
"data1": 2,
"data2": 22,
"data3": 25004,
"data2": 25004,
"data3": 22,
"data4": 0,
"data5": 0
},
@ -1030,8 +1030,8 @@
"type": 61,
"valid": 0,
"NPC": 105,
"data1": 1100105,
"data2": 0,
"data1": 1,
"data2": 1100105,
"data3": 0,
"data4": 0,
"data5": 0
@ -1744,8 +1744,8 @@
"type": 61,
"valid": 0,
"NPC": 29,
"data1": 1100101,
"data2": 0,
"data1": 1,
"data2": 1100101,
"data3": 0,
"data4": 0,
"data5": 0
@ -1761,8 +1761,8 @@
"type": 61,
"valid": 0,
"NPC": 0,
"data1": 104,
"data2": 0,
"data1": 1,
"data2": 104,
"data3": 0,
"data4": 0,
"data5": 0
@ -1778,8 +1778,8 @@
"type": 61,
"valid": 0,
"NPC": 0,
"data1": 108,
"data2": 0,
"data1": 1,
"data2": 108,
"data3": 0,
"data4": 0,
"data5": 0
@ -1812,8 +1812,8 @@
"type": 61,
"valid": 0,
"NPC": 105,
"data1": 1100106,
"data2": 0,
"data1": 1,
"data2": 1100106,
"data3": 0,
"data4": 0,
"data5": 0
@ -6334,8 +6334,8 @@
"type": 61,
"valid": 0,
"NPC": 10191,
"data1": 1100206,
"data2": 0,
"data1": 1,
"data2": 1100206,
"data3": 0,
"data4": 0,
"data5": 0
@ -6419,8 +6419,8 @@
"type": 61,
"valid": 0,
"NPC": 10241,
"data1": 1100301,
"data2": 0,
"data1": 1,
"data2": 1100301,
"data3": 0,
"data4": 0,
"data5": 0
@ -6436,8 +6436,8 @@
"type": 61,
"valid": 0,
"NPC": 10251,
"data1": 1100306,
"data2": 0,
"data1": 1,
"data2": 1100306,
"data3": 0,
"data4": 0,
"data5": 0
@ -6504,8 +6504,8 @@
"type": 61,
"valid": 0,
"NPC": 10291,
"data1": 1100406,
"data2": 0,
"data1": 1,
"data2": 1100406,
"data3": 0,
"data4": 0,
"data5": 0
@ -6589,8 +6589,8 @@
"type": 61,
"valid": 0,
"NPC": 10341,
"data1": 1100506,
"data2": 0,
"data1": 1,
"data2": 1100506,
"data3": 0,
"data4": 0,
"data5": 0
@ -6708,8 +6708,8 @@
"type": 61,
"valid": 0,
"NPC": 10411,
"data1": 1100606,
"data2": 0,
"data1": 1,
"data2": 1100606,
"data3": 0,
"data4": 0,
"data5": 0
@ -6793,8 +6793,8 @@
"type": 61,
"valid": 0,
"NPC": 10461,
"data1": 1100706,
"data2": 0,
"data1": 1,
"data2": 1100706,
"data3": 0,
"data4": 0,
"data5": 0
@ -6844,8 +6844,8 @@
"type": 61,
"valid": 0,
"NPC": 10491,
"data1": 1100806,
"data2": 0,
"data1": 1,
"data2": 1100806,
"data3": 0,
"data4": 0,
"data5": 0
@ -6895,8 +6895,8 @@
"type": 61,
"valid": 0,
"NPC": 10521,
"data1": 1100906,
"data2": 0,
"data1": 1,
"data2": 1100906,
"data3": 0,
"data4": 0,
"data5": 0
@ -6929,8 +6929,8 @@
"type": 61,
"valid": 0,
"NPC": 10541,
"data1": 11001006,
"data2": 0,
"data1": 1,
"data2": 11001006,
"data3": 0,
"data4": 0,
"data5": 0
@ -6980,8 +6980,8 @@
"type": 61,
"valid": 0,
"NPC": 10571,
"data1": 11001106,
"data2": 0,
"data1": 1,
"data2": 11001106,
"data3": 0,
"data4": 0,
"data5": 0
@ -7014,8 +7014,8 @@
"type": 61,
"valid": 0,
"NPC": 10591,
"data1": 11001206,
"data2": 0,
"data1": 1,
"data2": 11001206,
"data3": 0,
"data4": 0,
"data5": 0
@ -7031,8 +7031,8 @@
"type": 61,
"valid": 0,
"NPC": 10601,
"data1": 1200103,
"data2": 0,
"data1": 1,
"data2": 1200103,
"data3": 0,
"data4": 0,
"data5": 0
@ -7048,8 +7048,8 @@
"type": 61,
"valid": 0,
"NPC": 10611,
"data1": 1200106,
"data2": 0,
"data1": 1,
"data2": 1200106,
"data3": 0,
"data4": 0,
"data5": 0
@ -7065,8 +7065,8 @@
"type": 61,
"valid": 0,
"NPC": 10621,
"data1": 1200203,
"data2": 0,
"data1": 1,
"data2": 1200203,
"data3": 0,
"data4": 0,
"data5": 0
@ -7082,8 +7082,8 @@
"type": 61,
"valid": 0,
"NPC": 10631,
"data1": 1200206,
"data2": 0,
"data1": 1,
"data2": 1200206,
"data3": 0,
"data4": 0,
"data5": 0
@ -7099,8 +7099,8 @@
"type": 61,
"valid": 0,
"NPC": 10641,
"data1": 1200303,
"data2": 0,
"data1": 1,
"data2": 1200303,
"data3": 0,
"data4": 0,
"data5": 0
@ -7116,8 +7116,8 @@
"type": 61,
"valid": 0,
"NPC": 10651,
"data1": 1200306,
"data2": 0,
"data1": 1,
"data2": 1200306,
"data3": 0,
"data4": 0,
"data5": 0
@ -7133,8 +7133,8 @@
"type": 61,
"valid": 0,
"NPC": 10661,
"data1": 1200403,
"data2": 0,
"data1": 1,
"data2": 1200403,
"data3": 0,
"data4": 0,
"data5": 0
@ -7150,8 +7150,8 @@
"type": 61,
"valid": 0,
"NPC": 10671,
"data1": 1200406,
"data2": 0,
"data1": 1,
"data2": 1200406,
"data3": 0,
"data4": 0,
"data5": 0
@ -7167,8 +7167,8 @@
"type": 61,
"valid": 0,
"NPC": 10681,
"data1": 1200503,
"data2": 0,
"data1": 1,
"data2": 1200503,
"data3": 0,
"data4": 0,
"data5": 0
@ -7184,8 +7184,8 @@
"type": 61,
"valid": 0,
"NPC": 10691,
"data1": 1200506,
"data2": 0,
"data1": 1,
"data2": 1200506,
"data3": 0,
"data4": 0,
"data5": 0
@ -7201,8 +7201,8 @@
"type": 61,
"valid": 0,
"NPC": 10701,
"data1": 1200603,
"data2": 0,
"data1": 1,
"data2": 1200603,
"data3": 0,
"data4": 0,
"data5": 0
@ -7218,8 +7218,8 @@
"type": 61,
"valid": 0,
"NPC": 10711,
"data1": 1200606,
"data2": 0,
"data1": 1,
"data2": 1200606,
"data3": 0,
"data4": 0,
"data5": 0
@ -7235,8 +7235,8 @@
"type": 61,
"valid": 0,
"NPC": 10721,
"data1": 1200703,
"data2": 0,
"data1": 1,
"data2": 1200703,
"data3": 0,
"data4": 0,
"data5": 0
@ -7252,8 +7252,8 @@
"type": 61,
"valid": 0,
"NPC": 10731,
"data1": 1200706,
"data2": 0,
"data1": 1,
"data2": 1200706,
"data3": 0,
"data4": 0,
"data5": 0
@ -7269,8 +7269,8 @@
"type": 61,
"valid": 0,
"NPC": 10741,
"data1": 1200803,
"data2": 0,
"data1": 1,
"data2": 1200803,
"data3": 0,
"data4": 0,
"data5": 0
@ -7286,8 +7286,8 @@
"type": 61,
"valid": 0,
"NPC": 10751,
"data1": 1200806,
"data2": 0,
"data1": 1,
"data2": 1200806,
"data3": 0,
"data4": 0,
"data5": 0
@ -7303,8 +7303,8 @@
"type": 61,
"valid": 0,
"NPC": 10761,
"data1": 1200903,
"data2": 0,
"data1": 1,
"data2": 1200903,
"data3": 0,
"data4": 0,
"data5": 0
@ -7320,8 +7320,8 @@
"type": 61,
"valid": 0,
"NPC": 10771,
"data1": 1200906,
"data2": 0,
"data1": 1,
"data2": 1200906,
"data3": 0,
"data4": 0,
"data5": 0
@ -7337,8 +7337,8 @@
"type": 61,
"valid": 0,
"NPC": 10781,
"data1": 12001003,
"data2": 0,
"data1": 1,
"data2": 12001003,
"data3": 0,
"data4": 0,
"data5": 0
@ -7354,8 +7354,8 @@
"type": 61,
"valid": 0,
"NPC": 10791,
"data1": 12001006,
"data2": 0,
"data1": 1,
"data2": 12001006,
"data3": 0,
"data4": 0,
"data5": 0
@ -7371,8 +7371,8 @@
"type": 61,
"valid": 0,
"NPC": 10801,
"data1": 12001103,
"data2": 0,
"data1": 1,
"data2": 12001103,
"data3": 0,
"data4": 0,
"data5": 0
@ -7388,8 +7388,8 @@
"type": 61,
"valid": 0,
"NPC": 10811,
"data1": 12001106,
"data2": 0,
"data1": 1,
"data2": 12001106,
"data3": 0,
"data4": 0,
"data5": 0
@ -7405,8 +7405,8 @@
"type": 61,
"valid": 0,
"NPC": 10821,
"data1": 12001203,
"data2": 0,
"data1": 1,
"data2": 12001203,
"data3": 0,
"data4": 0,
"data5": 0
@ -7422,8 +7422,8 @@
"type": 61,
"valid": 0,
"NPC": 10831,
"data1": 12001206,
"data2": 0,
"data1": 1,
"data2": 12001206,
"data3": 0,
"data4": 0,
"data5": 0
@ -11060,8 +11060,8 @@
"type": 61,
"valid": 0,
"NPC": 0,
"data1": 1100105,
"data2": 0,
"data1": 1,
"data2": 1100105,
"data3": 0,
"data4": 0,
"data5": 0

View File

@ -15,6 +15,7 @@ import (
"path/filepath"
"strings"
"sync"
"sync/atomic"
cfg "go_dreamfactory/sys/configure/structs"
@ -29,7 +30,7 @@ import (
type RtaskTestView struct {
BaseformView
itemList *common.ItemList
resultCount int //结果条数
resultCount int32 //结果条数
resultChan chan string //结果内容
flag bool
msgs []string
@ -103,7 +104,6 @@ func (this *RtaskTestView) CreateView(t *model.TestCase) fyne.CanvasObject {
if tb, err := cfg.NewTables(commCfg.Loader); err == nil {
for _, v := range tb.RdtaskCondi.GetDataList() {
wg.Add(1)
this.resultCount++
params := []int32{v.Data1, v.Data2, v.Data3, v.Data4, v.Data5}
var p []int32
for _, v := range params {
@ -128,35 +128,45 @@ func (this *RtaskTestView) CreateView(t *model.TestCase) fyne.CanvasObject {
// msgs = append(msgs, fmt.Sprintf("condId:%v rtype:%v params:%v", condId, rtype, p))
}(v.Id, v.Type, p)
wg.Wait()
// time.Sleep(time.Millisecond * 100)
}
}
go func() {
for msg := range this.resultChan {
// logrus.Debug("add msg")
this.msgs = append(this.msgs, msg)
// old := atomic.LoadInt32(&this.resultCount)
// n := old - 1
// if atomic.CompareAndSwapInt32(&this.resultCount, old, n) {
// break
// }
}
}()
go func() {
if this.resultCount == 0 {
logrus.Debug("结束")
var flag bool
for !flag {
count := atomic.LoadInt32(&this.resultCount)
logrus.Debug("count:", count)
if count == 100 {
logrus.Debug("结束")
record := strings.Join(this.msgs, "\n")
var buf bytes.Buffer
buf.WriteString(fmt.Sprintf("---任务参数测试报告---\n"))
buf.WriteString(record)
buf.WriteString("\n-------")
record := strings.Join(this.msgs, "\n")
var buf bytes.Buffer
buf.WriteString(fmt.Sprintf("---任务参数测试报告---\n"))
buf.WriteString(record)
buf.WriteString("\n-------")
file, err := os.OpenFile(filepath.Join(this.reportPath, "report.txt"), os.O_TRUNC|os.O_CREATE, os.ModePerm)
if err != nil {
logrus.Error(err)
}
defer file.Close()
file, err := os.OpenFile(filepath.Join(this.reportPath, "report.txt"), os.O_TRUNC|os.O_CREATE, os.ModePerm)
if err != nil {
logrus.Error(err)
}
defer file.Close()
if _, err := file.WriteString(buf.String()); err != nil {
logrus.Error(err)
if _, err := file.WriteString(buf.String()); err != nil {
logrus.Error(err)
}
flag = true
}
}
}()
@ -221,12 +231,12 @@ func (this *RtaskTestView) rtestListener() {
return
}
// if !rsp.Flag {
msg := fmt.Sprintf("%v - %v", rsp.RtaskType, rsp.Flag)
this.resultChan <- msg
this.resultCount--
// }
atomic.AddInt32(&this.resultCount, 1)
logrus.Debug("resp", msg)
}
},
})

View File

@ -458,6 +458,11 @@ type TaskParam struct {
TT TaskType
Params []int32
}
type BuriedParam struct {
Btype TaskType
Value int32
Filter []int32
}
// 日常任务事件类型
const (

View File

@ -222,7 +222,7 @@ type (
// 随机任务
IRtask interface {
// 条件校验
CheckCondi(uid string, condiId int32) (code pb.ErrorCode)
CheckCondi(uid string, condiId int32, p ...int32) (code pb.ErrorCode)
// 多条件校验
CheckCondis(uid string, condiIds ...int32) (condIds []int32)
// 远程任务条件校验

View File

@ -11,7 +11,7 @@ import (
)
const (
gameTaskCond = "game_rdtaskcondi.json"
game_buriedcondi = "game_buriedcondi.json"
)
//配置管理组件
@ -19,31 +19,31 @@ type configureComp struct {
modules.MCompConfigure
module *Buried
lock sync.RWMutex
group map[comm.TaskType][]*cfg.GameRdtaskCondiData //安排点类型 分组
group map[comm.TaskType][]*cfg.GameBuriedCondiData //安排点类型 分组
}
//组件初始化接口
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.MCompConfigure.Init(service, module, comp, options)
this.module = module.(*Buried)
this.LoadConfigure(gameTaskCond, cfg.NewGameRdtaskCondi)
configure.RegisterConfigure(gameTaskCond, cfg.NewGameRdtaskCondi, this.updateconfigure)
this.LoadConfigure(game_buriedcondi, cfg.NewGameBuriedCondi)
configure.RegisterConfigure(game_buriedcondi, cfg.NewGameBuriedCondi, this.updateconfigure)
return
}
//动态更新配置
func (this *configureComp) updateconfigure() {
if v, err := this.GetConfigure(gameTaskCond); err != nil {
if v, err := this.GetConfigure(game_buriedcondi); err != nil {
return
} else {
if data, ok := v.(*cfg.GameRdtaskCondi); !ok {
err = fmt.Errorf("%T is *cfg.GameRdtaskCondi", v)
if data, ok := v.(*cfg.GameBuriedCondi); !ok {
err = fmt.Errorf("%T is *cfg.GameBuriedCondi", v)
return
} else {
group := map[comm.TaskType][]*cfg.GameRdtaskCondiData{}
group := map[comm.TaskType][]*cfg.GameBuriedCondiData{}
for _, v := range data.GetDataList() {
if _, ok = group[comm.TaskType(v.Type)]; !ok {
group[comm.TaskType(v.Type)] = make([]*cfg.GameRdtaskCondiData, 0)
group[comm.TaskType(v.Type)] = make([]*cfg.GameBuriedCondiData, 0)
}
group[comm.TaskType(v.Type)] = append(group[comm.TaskType(v.Type)], v)
}
@ -55,8 +55,8 @@ func (this *configureComp) updateconfigure() {
}
//读取埋点条件配置
func (this *configureComp) getCondiDatas(tt comm.TaskType) (result []*cfg.GameRdtaskCondiData) {
result = make([]*cfg.GameRdtaskCondiData, 0)
func (this *configureComp) getCondiDatas(tt comm.TaskType) (result []*cfg.GameBuriedCondiData) {
result = make([]*cfg.GameBuriedCondiData, 0)
this.lock.RLock()
if _, ok := this.group[tt]; ok {
result = this.group[tt]

View File

@ -2,18 +2,83 @@ package buried
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
)
//判断埋点数据的有效性
func checkburied(buried *comm.TaskParam, conf *cfg.GameRdtaskCondiData) (efficient bool) {
const (
//创号后入录数据
rtype1 = 1
//接任务后入录数据
rtype2 = 2
)
return false
const (
//叠加数据
overlay = 1
//覆盖数据
cover = 2
)
const (
eq = "eq" // ==
gt = "gt" // >
gte = "gte" //>=
lt = "lt" // <
lte = "lte" // <=
ne = "ne" // !=
)
//判断埋点数据的有效性
func checkburied(buried *comm.BuriedParam, conf *cfg.GameBuriedCondiData) (efficient bool) {
if len(buried.Filter) != len(conf.Filter) {
log.Error("校验埋点错误!", log.Field{Key: "buried", Value: buried}, log.Field{Key: "conf", Value: conf})
return
}
for i, v := range conf.Filter {
efficient = false
value := buried.Filter[i]
switch v.S {
case eq: //==
if value == v.D {
efficient = true
}
case gt: //>
if value > v.D {
efficient = true
}
case gte: //>=
if value >= v.D {
efficient = true
}
case lt: //<
if value < v.D {
efficient = true
}
case lte: //<=
if value <= v.D {
efficient = true
}
case ne: //!=
if value != v.D {
efficient = true
}
default:
log.Error("校验埋点配置错误!", log.Field{Key: "不存在的比较符号", Value: v}, log.Field{Key: "buried", Value: buried}, log.Field{Key: "conf", Value: conf})
return
}
if !efficient { //校验不过
return
}
}
efficient = true
return
}
//更新埋点数据
func updateburied(buried *comm.TaskParam, conf *cfg.GameRdtaskCondiData, data *pb.DBBuriedItem) (err error) {
func updateburied(buried *comm.TaskParam, conf *cfg.GameBuriedCondiData, data *pb.DBBuriedItem) (err error) {
return
}

View File

@ -3,7 +3,9 @@ package buried
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/mgo"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go_dreamfactory/sys/db"
"go.mongodb.org/mongo-driver/mongo"
@ -28,15 +30,38 @@ func (this *modelBuried) Init(service core.IService, module core.IModule, comp c
//更新埋点数据到db中
func (this *modelBuried) getburiedModel(uid string) (model *buriedModel, err error) {
var m *db.DBModel
if db.IsCross() {
this.module.GetDBModelByUid(uid, this.TableName)
if m, err = this.module.GetDBModelByUid(uid, this.TableName); err != nil {
return
}
model = &buriedModel{module: this.module, model: m}
} else {
model = &buriedModel{module: this.module, model: this.DBModel}
}
return
}
//埋点专属模型 会封装特殊的数据转换接口
type buriedModel struct {
db.DBModel
module *Buried
model *db.DBModel
}
//获取用户全部的埋点数据
func (this *buriedModel) getUserBurieds(uid string) (results map[int32]*pb.DBBuried, err error) {
temp := make([]*pb.DBBuried, 0)
if err = this.model.GetList(uid, &temp); err != nil && err != mgo.MongodbNil {
this.module.Errorln(err)
return
}
for _, v := range temp {
results[v.Btype] = v
}
return
}
func (this *buriedModel) updateUserBurieds(bdatas map[int32]*pb.DBBuried) (err error) {
return
}

View File

@ -1,10 +1,15 @@
package buried
import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"time"
)
/*
@ -47,14 +52,108 @@ func (this *Buried) OnInstallComp() {
this.modelBuried = this.RegisterComp(new(modelBuried)).(*modelBuried)
}
//激活数据采集点
func (this *Buried) ActivationBuried(uid string, conids ...int32) (err error) {
return
}
//触发埋点
func (this *Buried) TriggerBuried(uid string, taskParams ...*comm.TaskParam) {
for _, buried := range taskParams {
conds := this.configure.getCondiDatas(buried.TT)
func (this *Buried) TriggerBuried(uid string, burieds ...*comm.BuriedParam) {
var (
pass map[*comm.BuriedParam][]*cfg.GameBuriedCondiData = make(map[*comm.BuriedParam][]*cfg.GameBuriedCondiData)
model *buriedModel
bdatas map[int32]*pb.DBBuried
bdata *pb.DBBuried
ok bool
complete bool
completeConIds []int32 //完成id列表
err error
)
if model, err = this.modelBuried.getburiedModel(uid); err != nil {
this.Error("获取用户埋点数据模型对象失败!", log.Field{Key: "err", Value: err.Error()})
return
}
for _, buried := range burieds {
conds := this.configure.getCondiDatas(buried.Btype)
for _, cond := range conds {
if checkburied(buried, cond) { //判断此埋点数据是否有效
if _, ok := pass[buried]; !ok {
pass[buried] = make([]*cfg.GameBuriedCondiData, 0)
}
pass[buried] = append(pass[buried], cond)
}
}
}
if len(pass) > 0 {
if bdatas, err = model.getUserBurieds(uid); err != nil {
return
}
}
completeConIds = make([]int32, 0)
//处理校验通过埋点数据
for buried, conds := range pass {
if bdata, ok = bdatas[bdata.Btype]; !ok {
bdatas[bdata.Btype] = &pb.DBBuried{
Uid: uid,
Btype: bdata.Btype,
Items: make(map[int32]*pb.DBBuriedItem),
}
}
for _, cond := range conds {
if cond.Rtype == rtype1 { //创号后入录
if complete, err = this.updateAndCheckBuried(bdata, buried, cond, true); complete {
completeConIds = append(completeConIds, cond.Id)
}
} else if cond.Rtype == rtype2 { //任务接取后才会录入 判断用户埋点数据是否存在 不存在等待任务系统调用接口 ActivationBuried 激活
if complete, err = this.updateAndCheckBuried(bdata, buried, cond, false); complete {
completeConIds = append(completeConIds, cond.Id)
}
}
}
}
//通知事件
if len(completeConIds) > 0 {
}
}
//更新并校验完成
func (this *Buried) updateAndCheckBuried(bdata *pb.DBBuried, burie *comm.BuriedParam, cond *cfg.GameBuriedCondiData, autoActivated bool) (complete bool, err error) {
var (
ok bool
bitem *pb.DBBuriedItem
)
if bitem, ok = bdata.Items[int32(cond.Id)]; !ok {
if autoActivated { //自动激活
bitem = &pb.DBBuriedItem{
Conid: cond.Id,
State: pb.BuriedItemState_Activated,
Value: 0,
Timestamp: time.Now().Unix(),
}
} else {
return
}
}
if bitem.State == pb.BuriedItemState_Inactivated || bitem.State == pb.BuriedItemState_Freeze { //未激活和冻结 不在处理
return
}
switch cond.Vtype { //数据接入方式
case overlay: //累加数据
bitem.Value += burie.Value
case cover:
bitem.Value = burie.Value
default:
err = fmt.Errorf("未知的埋点数据处理类型:%d", cond.Vtype)
return
}
if bitem.Value >= cond.Value { //完成进度
complete = true
}
return
}

View File

@ -13,7 +13,7 @@ func (this *apiComp) RtestCheck(session comm.IUserSession, req *pb.RtaskTestReq)
}
func (this *apiComp) Rtest(session comm.IUserSession, req *pb.RtaskTestReq) (code pb.ErrorCode, data *pb.ErrorData) {
rsp := &pb.RtaskTestResp{Flag: true}
rsp := &pb.RtaskTestResp{Flag: true,RtaskType: req.RtaskType}
if req.CondiId != 0 {
if code = this.moduleRtask.CheckCondi(session.GetUserId(), req.CondiId); code != pb.ErrorCode_Success {
rsp.Flag = false
@ -44,7 +44,6 @@ func (this *apiComp) Rtest(session comm.IUserSession, req *pb.RtaskTestReq) (cod
}
this.moduleRtask.modelRtask.Change(rtask.Uid, update)
} else {
this.moduleRtask.TriggerTask(session.GetUserId(), &comm.TaskParam{
TT: comm.TaskType(req.RtaskType),

View File

@ -75,6 +75,7 @@ func (this *ModelRtaskRecord) getRecord(uid string) *pb.DBRtaskRecord {
if err == mongo.ErrNoDocuments {
record.Id = primitive.NewObjectID().Hex()
record.Ctime = configure.Now().Unix()
record.Vals = make(map[int32]*pb.RtaskData)
if err := this.Add(uid, record); err != nil {
log.Errorln(err)
return nil

View File

@ -72,7 +72,7 @@ func (this *ModelRtask) GetRtask(uid string) *pb.DBRtask {
// }
// 确定选项前的校验
func (this *ModelRtask) checkCondi(uid string, condiId int32, record *pb.DBRtaskRecord) (err error, ok bool) {
func (this *ModelRtask) checkCondi(uid string, condiId int32, record *pb.DBRtaskRecord, params ...int32) (err error, ok bool) {
if condiId <= 0 {
return nil, true
}
@ -110,7 +110,7 @@ func (this *ModelRtask) checkCondi(uid string, condiId int32, record *pb.DBRtask
return
}
if ok, err = condi.verify(uid, record, conf); !ok {
if ok, _, err = condi.verify(uid, record, conf, params...); !ok {
err = errors.WithMessagef(err, "uid: %v do rtask [condiId:%v] condition not reach", uid, condiId)
return
}

View File

@ -30,7 +30,7 @@ type rtaskCondHandle struct {
}
// 任务参数校验
type verifyHandle func(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (bool, error)
type verifyHandle func(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (bool, int32, error)
// 任务数据更新
type updateDataHandle func(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, vals ...int32) error
@ -168,8 +168,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (handles []*rtaskCondHandle
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
case comm.Rtype16, comm.Rtype17,
comm.Rtype35, comm.Rtype61:
case comm.Rtype16, comm.Rtype17, comm.Rtype35:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtaskRecord.verifyGreatEqual,
@ -177,10 +176,17 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (handles []*rtaskCondHandle
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
case comm.Rtype61:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtaskRecord.veriftyFirstGreatParam,
update: this.modelRtaskRecord.addUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
case comm.Rtype23, comm.Rtype25, comm.Rtype30,
comm.Rtype32, comm.Rtype33, comm.Rtype34, comm.Rtype36,
comm.Rtype37, comm.Rtype40, comm.Rtype41,
comm.Rtype42, comm.Rtype43,
comm.Rtype37, comm.Rtype40,
comm.Rtype46, comm.Rtype47, comm.Rtype73, comm.Rtype76, comm.Rtype77, comm.Rtype79, comm.Rtype80, comm.Rtype83,
comm.Rtype52, comm.Rtype55, comm.Rtype56, comm.Rtype82,
comm.Rtype65, comm.Rtype66, comm.Rtype67, comm.Rtype68, comm.Rtype70, comm.Rtype140,
@ -192,6 +198,22 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (handles []*rtaskCondHandle
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
case comm.Rtype41, comm.Rtype42:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtaskRecord.verifyThirdGreatEqualParam,
update: this.modelRtaskRecord.addUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
case comm.Rtype43:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtask.verifyRtype43,
update: this.modelRtaskRecord.overrideUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
case comm.Rtype78:
handle := &rtaskCondHandle{
condId: v.Id,
@ -268,25 +290,32 @@ func (this *ModuleRtask) processOneTask(session comm.IUserSession, rtaskType com
}
}
}
if handle.verify != nil {
if ok, d, _ := handle.verify(uid, record, conf, params...); ok {
if handle.update != nil {
if d > 0 {
params[0] = d
}
if err := handle.update(uid, record, conf, params...); err != nil {
log.Errorf("update task:%v", err)
code = pb.ErrorCode_DBError
return
}
}
condIds = append(condIds, handle.condId)
if handle.update != nil {
if err := handle.update(uid, record, conf, params...); err != nil {
log.Errorf("update task:%v", err)
code = pb.ErrorCode_DBError
return
update := map[string]interface{}{
"vals": record.Vals,
}
this.modelRtaskRecord.Change(uid, update)
}
}
condIds = append(condIds, handle.condId)
}
update := map[string]interface{}{
"vals": record.Vals,
}
this.modelRtaskRecord.Change(uid, update)
for _, condId := range condIds {
if code = this.CheckCondi(uid, condId); code == pb.ErrorCode_Success {
if code = this.CheckCondi(uid, condId, params...); code == pb.ErrorCode_Success {
module, err := this.service.GetModule(comm.ModuleWorldtask)
if err == nil {
//世界任务
@ -357,13 +386,20 @@ func (this *ModuleRtask) TriggerTask(uid string, taskParams ...*comm.TaskParam)
}
// 任务条件校验
func (this *ModuleRtask) CheckCondi(uid string, condiId int32) (code pb.ErrorCode) {
func (this *ModuleRtask) CheckCondi(uid string, condiId int32, params ...int32) (code pb.ErrorCode) {
record := this.modelRtaskRecord.getRecord(uid)
if record == nil {
code = pb.ErrorCode_DataNotFound
return
}
if _, ok := this.modelRtask.checkCondi(uid, condiId, record); !ok {
if len(params) == 0 {
if v, ok := record.Vals[condiId]; ok {
for _, p := range v.Data {
params = append(params, p)
}
}
}
if _, ok := this.modelRtask.checkCondi(uid, condiId, record, params...); !ok {
code = pb.ErrorCode_RtaskCondiNoReach
return
}

View File

@ -12,70 +12,64 @@ import (
"github.com/spf13/cast"
)
// GreatEqual
func (this *ModelRtaskRecord) verifyGreatEqual(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
if record == nil {
err = errors.WithMessagef(err, "玩家数据DBRtaskRecord空")
// five params (1-GreatEqual 2-equal 3-equal 4-equal 5-equal)
func (this *ModelRtaskRecord) verifyGreatEqual(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
if len(params) == 0 {
err = errors.New("玩家参数数据缺失")
return
}
if v, f := record.Vals[cfg.Id]; f {
if len(v.Data) == 0 {
err = errors.WithMessagef(err, "玩家参数数据缺失 %v", v.Data)
var paramLen int
if paramLen, err = lenParam(cfg, params...); err == nil {
//参数比较,默认第一个参数soGreateEqual,其它soEqual
switch paramLen {
case 1:
ok, err = soGreatEqual(params[0], cfg.Data1)
return
}
var paramLen int
if paramLen, err = lenParam(cfg, toArr(v.Data)...); err == nil {
//参数比较,默认第一个参数soGreateEqual,其它soEqual
switch paramLen {
case 1:
return soGreatEqual(v.Data[0], cfg.Data1)
case 2:
if ok, err = soGreatEqual(v.Data[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(v.Data[1], cfg.Data2); !ok {
return
}
case 3:
if ok, err = soGreatEqual(v.Data[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(v.Data[1], cfg.Data2); !ok {
return
}
if ok, err = soEqual(v.Data[2], cfg.Data3); !ok {
return
}
case 4:
if ok, err = soGreatEqual(v.Data[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(v.Data[1], cfg.Data2); !ok {
return
}
if ok, err = soEqual(v.Data[2], cfg.Data3); !ok {
return
}
if ok, err = soEqual(v.Data[3], cfg.Data4); !ok {
return
}
case 5:
if ok, err = soGreatEqual(v.Data[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(v.Data[1], cfg.Data2); !ok {
return
}
if ok, err = soEqual(v.Data[2], cfg.Data3); !ok {
return
}
if ok, err = soEqual(v.Data[3], cfg.Data4); !ok {
return
}
if ok, err = soEqual(v.Data[4], cfg.Data5); !ok {
return
}
case 2:
if ok, err = soGreatEqual(params[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
case 3:
if ok, err = soGreatEqual(params[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
if ok, err = soEqual(params[2], cfg.Data3); !ok {
return
}
case 4:
if ok, err = soGreatEqual(params[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
if ok, err = soEqual(params[2], cfg.Data3); !ok {
return
}
if ok, err = soEqual(params[3], cfg.Data4); !ok {
return
}
case 5:
if ok, err = soGreatEqual(params[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
if ok, err = soEqual(params[2], cfg.Data3); !ok {
return
}
if ok, err = soEqual(params[3], cfg.Data4); !ok {
return
}
if ok, err = soEqual(params[4], cfg.Data5); !ok {
return
}
}
}
@ -83,86 +77,113 @@ func (this *ModelRtaskRecord) verifyGreatEqual(uid string, record *pb.DBRtaskRec
return
}
func (this *ModelRtaskRecord) verifyFirstEqualParam(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
if v, f := record.Vals[cfg.Id]; f {
if len(v.Data) == 0 {
err = errors.WithMessagef(err, "玩家参数数据缺失 %v", v.Data)
return
}
return soEqual(v.Data[0], cfg.Data1)
// firstParam (first-Equal)
func (this *ModelRtaskRecord) verifyFirstEqualParam(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
if len(params) == 1 {
ok, err = soEqual(params[0], cfg.Data1)
}
return
}
func (this *ModelRtaskRecord) verifyFirstGreatEqualParam(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
if v, f := record.Vals[cfg.Id]; f {
if len(v.Data) == 0 {
err = errors.WithMessagef(err, "玩家参数数据缺失 %v", v.Data)
return
}
return soGreatEqual(v.Data[0], cfg.Data1)
// firstParam (first-greatEqual)
func (this *ModelRtaskRecord) verifyFirstGreatEqualParam(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
if len(params) == 1 {
ok = true
// ok, err = soGreatEqual(params[0], cfg.Data1)
}
return
}
func (this *ModelRtaskRecord) verifyThirdLessEqualParam(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
if v, f := record.Vals[cfg.Id]; f {
if len(v.Data) == 0 {
err = errors.WithMessagef(err, "玩家参数数据缺失 %v", v.Data)
// three params (first-greatEqual second-equal third-lessEqual)
func (this *ModelRtaskRecord) verifyThirdLessEqualParam(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
if len(params) == 0 {
err = errors.New("玩家参数数据缺失")
return
}
var paramLen int
if paramLen, err = lenParam(cfg, params...); err == nil {
//参数比较,默认第一个参数soGreateEqual,其它soEqual
switch paramLen {
case 1:
ok, err = soGreatEqual(params[0], cfg.Data1)
return
}
var paramLen int
if paramLen, err = lenParam(cfg, toArr(v.Data)...); err == nil {
//参数比较,默认第一个参数soGreateEqual,其它soEqual
switch paramLen {
case 1:
return soGreatEqual(v.Data[0], cfg.Data1)
case 2:
if ok, err = soGreatEqual(v.Data[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(v.Data[1], cfg.Data2); !ok {
return
}
case 3:
if ok, err = soGreatEqual(v.Data[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(v.Data[1], cfg.Data2); !ok {
return
}
if ok, err = soLessEqual(v.Data[2], cfg.Data3); !ok {
return
}
case 2:
if ok, err = soGreatEqual(params[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
case 3:
if ok, err = soGreatEqual(params[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
if ok, err = soLessEqual(params[2], cfg.Data3); !ok {
return
}
}
}
return
}
func (this *ModelRtaskRecord) veriftyFirstGreatParam(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
if v, f := record.Vals[cfg.Id]; f {
if len(v.Data) == 0 {
err = errors.WithMessagef(err, "玩家参数数据缺失 %v", v.Data)
// three params (first-greatEqual second-equal third-greatEqual)
func (this *ModelRtaskRecord) verifyThirdGreatEqualParam(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
if len(params) == 0 {
err = errors.New("玩家参数数据缺失")
return
}
var paramLen int
if paramLen, err = lenParam(cfg, params...); err == nil {
//参数比较,默认第一个参数soGreateEqual,其它soEqual
switch paramLen {
case 1:
ok, err = soGreatEqual(params[0], cfg.Data1)
return
case 2:
if ok, err = soGreatEqual(params[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
case 3:
if ok, err = soGreatEqual(params[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
if ok, err = soGreatEqual(params[2], cfg.Data3); !ok {
return
}
}
}
return
}
var paramLen int
if paramLen, err = lenParam(cfg, toArr(v.Data)...); err == nil {
//参数比较,默认第一个参数soGreateEqual,其它soEqual
switch paramLen {
case 1:
return soGreat(v.Data[0], cfg.Data1)
case 2:
if ok, err = soGreat(v.Data[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(v.Data[1], cfg.Data2); !ok {
return
}
// two params(first-Great second-Equal)
func (this *ModelRtaskRecord) veriftyFirstGreatParam(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
if len(params) == 0 {
err = errors.New("玩家参数数据缺失")
return
}
var paramLen int
if paramLen, err = lenParam(cfg, params...); err == nil {
//参数比较,默认第一个参数soGreateEqual,其它soEqual
switch paramLen {
case 1:
ok, err = soGreat(params[0], cfg.Data1)
return
case 2:
if ok, err = soGreat(params[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
}
}
@ -170,7 +191,7 @@ func (this *ModelRtaskRecord) veriftyFirstGreatParam(uid string, record *pb.DBRt
}
// 英雄指定
func (this *ModelRtask) verfiyRtype1(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
func (this *ModelRtask) verfiyRtype1(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, err error) {
heroModule, err := this.service.GetModule(comm.ModuleHero)
if err != nil {
return false, err
@ -189,7 +210,7 @@ func (this *ModelRtask) verfiyRtype1(uid string, record *pb.DBRtaskRecord, cfg *
// 剧情
// Deprecated
func (this *ModelRtask) verifyRtype2(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
func (this *ModelRtask) verifyRtype2(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, err error) {
m, err := this.service.GetModule(comm.ModuleMline)
if err != nil {
return
@ -203,7 +224,7 @@ func (this *ModelRtask) verifyRtype2(uid string, record *pb.DBRtaskRecord, cfg *
}
// 每日任务
func (this *ModelRtask) verifyRtype3(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
func (this *ModelRtask) verifyRtype3(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
m, err := this.service.GetModule(comm.ModuleTask)
if err != nil {
return
@ -221,7 +242,7 @@ func (this *ModelRtask) verifyRtype3(uid string, record *pb.DBRtaskRecord, cfg *
}
// 指定英雄等级
func (this *ModelRtask) verifyRtype4(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
func (this *ModelRtask) verifyRtype4(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
m, err := this.service.GetModule(comm.ModuleHero)
if err != nil {
return
@ -248,7 +269,7 @@ func (this *ModelRtask) verifyRtype4(uid string, record *pb.DBRtaskRecord, cfg *
}
// 指定英雄的指定装备数量
func (this *ModelRtask) verifyRtype5(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
func (this *ModelRtask) verifyRtype5(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, err error) {
m, err := this.service.GetModule(comm.ModuleHero)
if err != nil {
return
@ -285,7 +306,7 @@ func (this *ModelRtask) verifyRtype5(uid string, record *pb.DBRtaskRecord, cfg *
}
// 指定英雄星级
func (this *ModelRtask) verifyRtype6(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
func (this *ModelRtask) verifyRtype6(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, err error) {
m, err := this.service.GetModule(comm.ModuleHero)
if err != nil {
return
@ -311,7 +332,7 @@ func (this *ModelRtask) verifyRtype6(uid string, record *pb.DBRtaskRecord, cfg *
}
// 日常登录一次
func (this *ModelRtask) verfiyRtype7(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
func (this *ModelRtask) verfiyRtype7(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, err error) {
userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
@ -326,7 +347,7 @@ func (this *ModelRtask) verfiyRtype7(uid string, record *pb.DBRtaskRecord, cfg *
}
// 累计登陆xx天
func (this *ModelRtask) verfiyRtype8(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
func (this *ModelRtask) verfiyRtype8(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, err error) {
userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
@ -343,7 +364,7 @@ func (this *ModelRtask) verfiyRtype8(uid string, record *pb.DBRtaskRecord, cfg *
}
// 连续登陆xx天 未埋点的处理方法
func (this *ModelRtask) verfiyRtype9(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
func (this *ModelRtask) verfiyRtype9(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
@ -352,15 +373,15 @@ func (this *ModelRtask) verfiyRtype9(uid string, record *pb.DBRtaskRecord, cfg *
if um, y := userModule.(comm.IUser); y {
ud, err := um.GetUserExpand(uid)
if err != nil {
return false, err
return false, 0, err
}
return soGreatEqual(ud.LoginContinueCount, cfg.Data1)
ok, err = soGreatEqual(ud.LoginContinueCount, cfg.Data1)
}
return
}
// 拥有xx个好友
func (this *ModelRtask) verfiyRtype10(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
func (this *ModelRtask) verfiyRtype10(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
m, err := this.service.GetModule(comm.ModuleFriend)
if err != nil {
return
@ -368,13 +389,13 @@ func (this *ModelRtask) verfiyRtype10(uid string, record *pb.DBRtaskRecord, cfg
if mi, y := m.(comm.IFriend); y {
count := mi.GetFriendCount(uid)
return soGreatEqual(count, cfg.Data1)
ok, err = soGreatEqual(count, cfg.Data1)
}
return
}
// 用户等级达到xx级
func (this *ModelRtask) verifyRtype20(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
func (this *ModelRtask) verifyRtype20(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
@ -382,14 +403,15 @@ func (this *ModelRtask) verifyRtype20(uid string, record *pb.DBRtaskRecord, cfg
if um, y := userModule.(comm.IUser); y {
if user := um.GetUser(uid); user != nil {
return soGreatEqual(user.Lv, cfg.Data1)
ok, err = soGreatEqual(user.Lv, cfg.Data1)
return
}
}
return
}
// 日常任务活跃度达到xx
func (this *ModelRtask) verifyRtype63(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
func (this *ModelRtask) verifyRtype63(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
@ -398,11 +420,11 @@ func (this *ModelRtask) verifyRtype63(uid string, record *pb.DBRtaskRecord, cfg
if um, y := userModule.(comm.IUser); y {
de, err := um.GetUserExpand(uid)
if err != nil {
return false, err
return false, 0, err
}
if de != nil {
return soGreatEqual(de.Activeday, cfg.Data1)
ok, err = soGreatEqual(de.Activeday, cfg.Data1)
}
}
@ -410,7 +432,7 @@ func (this *ModelRtask) verifyRtype63(uid string, record *pb.DBRtaskRecord, cfg
}
// 记录玩家在线时间并记入进度
func (this *ModelRtask) verifyRtype138(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
func (this *ModelRtask) verifyRtype138(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
@ -420,8 +442,22 @@ func (this *ModelRtask) verifyRtype138(uid string, record *pb.DBRtaskRecord, cfg
if user := um.GetUser(uid); user != nil {
now := configure.Now().Unix()
l := (now - user.Logintime) / 60
return soGreatEqual(int32(l), cfg.Data1)
ok, err = soGreatEqual(int32(l), cfg.Data1)
return
}
}
return
}
func (this *ModelRtask) verifyRtype43(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
equipment, ec := this.moduleRtask.ModuleEquipment.QueryEquipments(uid)
if ec == pb.ErrorCode_Success {
for _, e := range equipment {
if ok, _ = soGreatEqual(e.Lv, cfg.Data2); ok {
count++
}
}
}
ok = true
return
}

View File

@ -20,15 +20,69 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
//任务条件状态
type BuriedItemState int32
const (
BuriedItemState_Inactivated BuriedItemState = 0 //未激活 不接受输入入录
BuriedItemState_Activated BuriedItemState = 1 //已激活 接受输入入录
BuriedItemState_Freeze BuriedItemState = 2 //冻结 数据保留 不接受数据变化和时间推送
BuriedItemState_Sleep BuriedItemState = 3 //数据更新但是不主动触发时间
)
// Enum value maps for BuriedItemState.
var (
BuriedItemState_name = map[int32]string{
0: "Inactivated",
1: "Activated",
2: "Freeze",
3: "Sleep",
}
BuriedItemState_value = map[string]int32{
"Inactivated": 0,
"Activated": 1,
"Freeze": 2,
"Sleep": 3,
}
)
func (x BuriedItemState) Enum() *BuriedItemState {
p := new(BuriedItemState)
*p = x
return p
}
func (x BuriedItemState) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (BuriedItemState) Descriptor() protoreflect.EnumDescriptor {
return file_buried_buried_db_proto_enumTypes[0].Descriptor()
}
func (BuriedItemState) Type() protoreflect.EnumType {
return &file_buried_buried_db_proto_enumTypes[0]
}
func (x BuriedItemState) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use BuriedItemState.Descriptor instead.
func (BuriedItemState) EnumDescriptor() ([]byte, []int) {
return file_buried_buried_db_proto_rawDescGZIP(), []int{0}
}
//埋点对应的条件数据
type DBBuriedItem struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Condid int32 `protobuf:"varint,1,opt,name=condid,proto3" json:"condid"` //条件id
Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp"` //最后一次操作时间
Value map[string]int32 `protobuf:"bytes,3,rep,name=value,proto3" json:"value" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //完成条件数据
Conid int32 `protobuf:"varint,1,opt,name=conid,proto3" json:"conid" bson:"conid"` //条件id
State BuriedItemState `protobuf:"varint,2,opt,name=state,proto3,enum=BuriedItemState" json:"state" bson:"state"` //状态
Value int32 `protobuf:"varint,3,opt,name=value,proto3" json:"value" bson:"value"` //条件值
Timestamp int64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp" bson:"timestamp"` //最后一次操作时间
}
func (x *DBBuriedItem) Reset() {
@ -63,9 +117,23 @@ func (*DBBuriedItem) Descriptor() ([]byte, []int) {
return file_buried_buried_db_proto_rawDescGZIP(), []int{0}
}
func (x *DBBuriedItem) GetCondid() int32 {
func (x *DBBuriedItem) GetConid() int32 {
if x != nil {
return x.Condid
return x.Conid
}
return 0
}
func (x *DBBuriedItem) GetState() BuriedItemState {
if x != nil {
return x.State
}
return BuriedItemState_Inactivated
}
func (x *DBBuriedItem) GetValue() int32 {
if x != nil {
return x.Value
}
return 0
}
@ -77,22 +145,15 @@ func (x *DBBuriedItem) GetTimestamp() int64 {
return 0
}
func (x *DBBuriedItem) GetValue() map[string]int32 {
if x != nil {
return x.Value
}
return nil
}
//DB埋点数据
type DBBuried struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
Btype int32 `protobuf:"varint,2,opt,name=btype,proto3" json:"btype" bson:"btype"` //埋点类型
Data []*DBBuriedItem `protobuf:"bytes,3,rep,name=data,proto3" json:"data" bson:"data"` //埋点同居诗句
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
Btype int32 `protobuf:"varint,2,opt,name=btype,proto3" json:"btype"` //@go_tags(`bson:"btype"`)埋点类型
Items map[int32]*DBBuriedItem `protobuf:"bytes,3,rep,name=items,proto3" json:"items" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" bson:"burieds"` //埋点数据 key条件id
}
func (x *DBBuried) Reset() {
@ -141,9 +202,9 @@ func (x *DBBuried) GetBtype() int32 {
return 0
}
func (x *DBBuried) GetData() []*DBBuriedItem {
func (x *DBBuried) GetItems() map[int32]*DBBuriedItem {
if x != nil {
return x.Data
return x.Items
}
return nil
}
@ -152,24 +213,31 @@ var File_buried_buried_db_proto protoreflect.FileDescriptor
var file_buried_buried_db_proto_rawDesc = []byte{
0x0a, 0x16, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x2f, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x5f,
0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xae, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x42,
0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e,
0x64, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x64, 0x69,
0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02,
0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12,
0x2e, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18,
0x2e, 0x44, 0x42, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x56, 0x61,
0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a,
0x38, 0x0a, 0x0a, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x55, 0x0a, 0x08, 0x44, 0x42, 0x42,
0x75, 0x72, 0x69, 0x65, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x74, 0x79, 0x70, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x74, 0x79, 0x70, 0x65, 0x12, 0x21, 0x0a,
0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42,
0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x80, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x42,
0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6e,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x6e, 0x69, 0x64, 0x12,
0x26, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10,
0x2e, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65,
0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a,
0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03,
0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0xa7, 0x01, 0x0a, 0x08,
0x44, 0x42, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x74,
0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x74, 0x79, 0x70, 0x65,
0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x14, 0x2e, 0x44, 0x42, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x47, 0x0a, 0x0a,
0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42,
0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x48, 0x0a, 0x0f, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49,
0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x6e, 0x61, 0x63,
0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x63, 0x74,
0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x72, 0x65, 0x65,
0x7a, 0x65, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x6c, 0x65, 0x65, 0x70, 0x10, 0x03, 0x42,
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -184,20 +252,23 @@ func file_buried_buried_db_proto_rawDescGZIP() []byte {
return file_buried_buried_db_proto_rawDescData
}
var file_buried_buried_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_buried_buried_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_buried_buried_db_proto_goTypes = []interface{}{
(*DBBuriedItem)(nil), // 0: DBBuriedItem
(*DBBuried)(nil), // 1: DBBuried
nil, // 2: DBBuriedItem.ValueEntry
(BuriedItemState)(0), // 0: BuriedItemState
(*DBBuriedItem)(nil), // 1: DBBuriedItem
(*DBBuried)(nil), // 2: DBBuried
nil, // 3: DBBuried.ItemsEntry
}
var file_buried_buried_db_proto_depIdxs = []int32{
2, // 0: DBBuriedItem.value:type_name -> DBBuriedItem.ValueEntry
0, // 1: DBBuried.data:type_name -> DBBuriedItem
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
0, // 0: DBBuriedItem.state:type_name -> BuriedItemState
3, // 1: DBBuried.items:type_name -> DBBuried.ItemsEntry
1, // 2: DBBuried.ItemsEntry.value:type_name -> DBBuriedItem
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_buried_buried_db_proto_init() }
@ -236,13 +307,14 @@ func file_buried_buried_db_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_buried_buried_db_proto_rawDesc,
NumEnums: 0,
NumEnums: 1,
NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_buried_buried_db_proto_goTypes,
DependencyIndexes: file_buried_buried_db_proto_depIdxs,
EnumInfos: file_buried_buried_db_proto_enumTypes,
MessageInfos: file_buried_buried_db_proto_msgTypes,
}.Build()
File_buried_buried_db_proto = out.File

View File

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

View File

@ -0,0 +1,66 @@
//------------------------------------------------------------------------------
// <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 GameBuriedCondiData struct {
Id int32
Rtype int32
TypeSp int32
Tasktxt string
Type int32
Valid int32
NPC int32
Vtype int32
Value int32
Filter []*Gamecompare
}
const TypeId_GameBuriedCondiData = 1792922092
func (*GameBuriedCondiData) GetTypeId() int32 {
return 1792922092
}
func (_v *GameBuriedCondiData)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["rtype"].(float64); !_ok_ { err = errors.New("rtype error"); return }; _v.Rtype = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type_sp"].(float64); !_ok_ { err = errors.New("type_sp error"); return }; _v.TypeSp = int32(_tempNum_) }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["tasktxt"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Tasktxt error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Tasktxt, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["valid"].(float64); !_ok_ { err = errors.New("valid error"); return }; _v.Valid = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["NPC"].(float64); !_ok_ { err = errors.New("NPC error"); return }; _v.NPC = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["vtype"].(float64); !_ok_ { err = errors.New("vtype error"); return }; _v.Vtype = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["value"].(float64); !_ok_ { err = errors.New("value error"); return }; _v.Value = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["filter"].([]interface{}); !_ok_ { err = errors.New("filter error"); return }
_v.Filter = make([]*Gamecompare, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ *Gamecompare
{ 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 = DeserializeGamecompare(_x_); err != nil { return } }
_v.Filter = append(_v.Filter, _list_v_)
}
}
return
}
func DeserializeGameBuriedCondiData(_buf map[string]interface{}) (*GameBuriedCondiData, error) {
v := &GameBuriedCondiData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View File

@ -0,0 +1,37 @@
//------------------------------------------------------------------------------
// <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 Gamecompare struct {
S string
D int32
}
const TypeId_Gamecompare = -229713143
func (*Gamecompare) GetTypeId() int32 {
return -229713143
}
func (_v *Gamecompare)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; if _v.S, _ok_ = _buf["s"].(string); !_ok_ { err = errors.New("s error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["d"].(float64); !_ok_ { err = errors.New("d error"); return }; _v.D = int32(_tempNum_) }
return
}
func DeserializeGamecompare(_buf map[string]interface{}) (*Gamecompare, error) {
v := &Gamecompare{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View File

@ -196,6 +196,7 @@ type Tables struct {
RuleDesc *GameRuleDesc
HeroTalent *GameHeroTalent
TalentBox *GameTalentBox
BuriedCondi *GameBuriedCondi
}
func NewTables(loader JsonLoader) (*Tables, error) {
@ -1313,5 +1314,11 @@ func NewTables(loader JsonLoader) (*Tables, error) {
if tables.TalentBox, err = NewGameTalentBox(buf) ; err != nil {
return nil, err
}
if buf, err = loader("game_buriedcondi") ; err != nil {
return nil, err
}
if tables.BuriedCondi, err = NewGameBuriedCondi(buf) ; err != nil {
return nil, err
}
return tables, nil
}