图鉴任务
This commit is contained in:
parent
b617e2815a
commit
25ea76c5bc
226
bin/json/game_smithytask.json
Normal file
226
bin/json/game_smithytask.json
Normal file
@ -0,0 +1,226 @@
|
||||
[
|
||||
{
|
||||
"key": 10001,
|
||||
"id_list": 1,
|
||||
"task_display": {
|
||||
"key": "task_10001",
|
||||
"text": "进行1次普通招募"
|
||||
},
|
||||
"type_id": 2018001,
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": 10002,
|
||||
"id_list": 2,
|
||||
"task_display": {
|
||||
"key": "task_10002",
|
||||
"text": "为任意英雄提升1次等级"
|
||||
},
|
||||
"type_id": 2024001,
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": 10004,
|
||||
"id_list": 4,
|
||||
"task_display": {
|
||||
"key": "task_10004",
|
||||
"text": "强化任意装备成功1次"
|
||||
},
|
||||
"type_id": 2047001,
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": 10006,
|
||||
"id_list": 6,
|
||||
"task_display": {
|
||||
"key": "task_10006",
|
||||
"text": "在商店购买任意1件商品"
|
||||
},
|
||||
"type_id": 2064001,
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": 10007,
|
||||
"id_list": 7,
|
||||
"task_display": {
|
||||
"key": "task_10007",
|
||||
"text": "使用好友助战英雄战斗1次"
|
||||
},
|
||||
"type_id": 2012001,
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": 10008,
|
||||
"id_list": 8,
|
||||
"task_display": {
|
||||
"key": "task_10008",
|
||||
"text": "进行竞技场挑战1次"
|
||||
},
|
||||
"type_id": 2130001,
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": 10009,
|
||||
"id_list": 9,
|
||||
"task_display": {
|
||||
"key": "task_10009",
|
||||
"text": "进行10次普通招募"
|
||||
},
|
||||
"type_id": 3018001,
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": 10010,
|
||||
"id_list": 10,
|
||||
"task_display": {
|
||||
"key": "task_10010",
|
||||
"text": "为任意英雄提升10次等级"
|
||||
},
|
||||
"type_id": 3024001,
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": 10011,
|
||||
"id_list": 12,
|
||||
"task_display": {
|
||||
"key": "task_10011",
|
||||
"text": "强化任意装备成功6次"
|
||||
},
|
||||
"type_id": 3047001,
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": 10012,
|
||||
"id_list": 14,
|
||||
"task_display": {
|
||||
"key": "task_10012",
|
||||
"text": "在商店购买任意7件商品"
|
||||
},
|
||||
"type_id": 3064001,
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": 10013,
|
||||
"id_list": 15,
|
||||
"task_display": {
|
||||
"key": "task_10013",
|
||||
"text": "使用好友助战英雄战斗7次"
|
||||
},
|
||||
"type_id": 3012001,
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": 10014,
|
||||
"id_list": 17,
|
||||
"task_display": {
|
||||
"key": "task_10014",
|
||||
"text": "刷新商店10次"
|
||||
},
|
||||
"type_id": 3105001,
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": 10015,
|
||||
"id_list": 18,
|
||||
"task_display": {
|
||||
"key": "task_10015",
|
||||
"text": "消费1000颗钻石"
|
||||
},
|
||||
"type_id": 3104001,
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": 10016,
|
||||
"id_list": 19,
|
||||
"task_display": {
|
||||
"key": "task_10016",
|
||||
"text": "进行30场竞技场挑战"
|
||||
},
|
||||
"type_id": 3130001,
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
@ -142,7 +142,8 @@ const (
|
||||
TableSeasonRecord = "seasonRecord" // 赛季塔记录
|
||||
/// 美食馆
|
||||
TableSmithy = "smithy"
|
||||
TableSmithyTrade = "trade"
|
||||
TableSmithyTrade = "smithytrade"
|
||||
TableSmithyTask = "smithytask"
|
||||
/// 赛季塔数据表
|
||||
TableSeasonPagoda = "seasonpagoda"
|
||||
//
|
||||
|
27
modules/smithy/api_receive.go
Normal file
27
modules/smithy/api_receive.go
Normal file
@ -0,0 +1,27 @@
|
||||
package smithy
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// 图鉴任务奖励领取
|
||||
func (this *apiComp) TaskAwardCheck(session comm.IUserSession, req *pb.SmithyTaskAwardReq) (code pb.ErrorCode) {
|
||||
if req.TaskId == 0 {
|
||||
return pb.ErrorCode_ReqParameterError
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *apiComp) TaskAward(session comm.IUserSession, req *pb.SmithyTaskAwardReq) (code pb.ErrorCode, data proto.Message) {
|
||||
if code = this.TaskAwardCheck(session, req); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
|
||||
resp:= &pb.SmithyTaskAwardResp{}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()),"taskaward", resp)
|
||||
return
|
||||
}
|
34
modules/smithy/api_refuse.go
Normal file
34
modules/smithy/api_refuse.go
Normal file
@ -0,0 +1,34 @@
|
||||
package smithy
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (this *apiComp) RefuseCheck(session comm.IUserSession, req *pb.SmithyRefuseReq) (code pb.ErrorCode) {
|
||||
if req.CustomerId == 0 {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *apiComp) Refuse(session comm.IUserSession, req *pb.SmithyRefuseReq) (code pb.ErrorCode, data proto.Message) {
|
||||
if code = this.RefuseCheck(session, req); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
|
||||
cus, err := this.module.modelTrade.updateCustomer(session.GetUserId(), req.CustomerId)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
|
||||
resp := &pb.SmithyRefuseResp{
|
||||
Customers: cus.Customers,
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), "refuse", resp)
|
||||
return
|
||||
}
|
@ -32,7 +32,11 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.SmithySellReq) (cod
|
||||
|
||||
this.module.ModuleEquipment.RecycleEquipments(session, req.EquipIds, this.module.modelStove.StoveToolsSellUp(session.GetUserId()))
|
||||
|
||||
_ = this.module.modelTrade.updateCustomer(session.GetUserId(), req.CustomerId)
|
||||
cus, err := this.module.modelTrade.updateCustomer(session.GetUserId(), req.CustomerId)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
|
||||
conf := this.module.configure.GetSmithyCustomerConf(req.CustomerId)
|
||||
if conf == nil {
|
||||
@ -46,6 +50,7 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.SmithySellReq) (cod
|
||||
rsp := &pb.SmithySellResp{
|
||||
CustomerId: req.CustomerId,
|
||||
EquipIds: req.EquipIds,
|
||||
Customers: cus.Customers,
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), "sell", rsp)
|
||||
|
@ -21,6 +21,7 @@ const (
|
||||
game_smithyatlas = "game_smithyatlas.json" // 收藏图鉴
|
||||
game_smithyatlaslv = "game_smithyatlaslv.json" // 收藏等级积分
|
||||
game_smithyatlasscore = "game_smithyatlasscore.json" // 图鉴积分
|
||||
game_smithytask = "game_smithytask.json" //图鉴任务
|
||||
)
|
||||
|
||||
// /配置管理基础组件
|
||||
@ -70,7 +71,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
||||
err = this.LoadConfigure(game_smithyatlas, cfg.NewGameSmithyAtlas)
|
||||
err = this.LoadConfigure(game_smithyatlaslv, cfg.NewGameSmithyAtlasLv)
|
||||
err = this.LoadConfigure(game_smithyatlasscore, cfg.NewGameSmithyAtlasScore)
|
||||
|
||||
err = this.LoadConfigure(game_smithytask, cfg.NewGameSmithyTask)
|
||||
return
|
||||
}
|
||||
|
||||
@ -290,3 +291,15 @@ func (this *configureComp) LoadSmithyAtlasScoreConf() {
|
||||
log.Errorf("get LoadSmithyAtlasScoreConf conf err:%v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// 获取图鉴任务配置
|
||||
func(this *configureComp) GetSmithyTask(taskId int32) (data *cfg.GameSmithyTaskData) {
|
||||
if v, err := this.GetConfigure(game_smithytask); err == nil {
|
||||
if configure, ok := v.(*cfg.GameSmithyTask); ok {
|
||||
data = configure.Get(taskId)
|
||||
return
|
||||
}
|
||||
}
|
||||
this.module.Errorf("GetSmithyTask notfound taskId:%d", taskId)
|
||||
return
|
||||
}
|
73
modules/smithy/model_task.go
Normal file
73
modules/smithy/model_task.go
Normal file
@ -0,0 +1,73 @@
|
||||
package smithy
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
)
|
||||
|
||||
type modelTask struct {
|
||||
modules.MCompModel
|
||||
module *Smithy
|
||||
}
|
||||
|
||||
func (this *modelTask) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
this.TableName = string(comm.TableSmithyTask)
|
||||
err = this.MCompModel.Init(service, module, comp, options)
|
||||
this.module = module.(*Smithy)
|
||||
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (this *modelTask) getTaskRecord(uid string) (*pb.DBTujianTask, error) {
|
||||
tt := &pb.DBTujianTask{}
|
||||
if err := this.Get(uid, tt); err != nil {
|
||||
return tt, err
|
||||
}
|
||||
return tt, nil
|
||||
}
|
||||
|
||||
func (this *modelTask) updateTaskRecord(uid string, taskId int32) error {
|
||||
if !this.CheckTaskStatus(uid, taskId) {
|
||||
return comm.NewCustomError(pb.ErrorCode_SmithyTaskNoFinished)
|
||||
}
|
||||
dt, err := this.getTaskRecord(uid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if dt.Uid == "" {
|
||||
this.Add(uid, &pb.DBTujianTask{Uid: uid, TaskId: taskId, Received: 2})
|
||||
} else {
|
||||
// 已存在 重复领取
|
||||
if dt.Received == 2 {
|
||||
return comm.NewCustomError(pb.ErrorCode_SmithyTaskReceived)
|
||||
} else {
|
||||
update := map[string]interface{}{
|
||||
"received": 2,
|
||||
}
|
||||
if err := this.Change(uid, update); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 检查任务状态
|
||||
func (this *modelTask) CheckTaskStatus(uid string, taskId int32) bool {
|
||||
conf := this.module.configure.GetSmithyTask(taskId)
|
||||
if conf == nil {
|
||||
return false
|
||||
}
|
||||
if ec := this.module.ModuleRtask.CheckCondi(uid, conf.TypeId); ec != pb.ErrorCode_Success {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
@ -119,16 +119,16 @@ func (s *modelTrade) removeCustomer(cus *pb.DBCustomer, customerId int32) *pb.DB
|
||||
}
|
||||
|
||||
// 随机新顾客
|
||||
func (s *modelTrade) updateCustomer(uid string, customerId int32) error {
|
||||
func (s *modelTrade) updateCustomer(uid string, customerId int32) (*pb.DBCustomer, error) {
|
||||
cus, err := s.getDBCustomer(uid)
|
||||
if err == nil {
|
||||
cus = s.removeCustomer(cus, customerId)
|
||||
cus.Total++
|
||||
//上限
|
||||
limit := 20
|
||||
left := limit - int(cus.Total)
|
||||
limit := s.module.modelStove.StoveSkillAddCustomer(uid)
|
||||
left := limit - cus.Total
|
||||
if left <= 0 {
|
||||
return comm.NewCustomError(pb.ErrorCode_SmithyCustomerLimit)
|
||||
return nil, comm.NewCustomError(pb.ErrorCode_SmithyCustomerLimit)
|
||||
}
|
||||
|
||||
cus.Customers = append(cus.Customers, &pb.CustomerInfo{
|
||||
@ -143,10 +143,10 @@ func (s *modelTrade) updateCustomer(uid string, customerId int32) error {
|
||||
"lastRefreshTime": cus.LastRefreshTime,
|
||||
}
|
||||
if err := s.Change(uid, update); err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
return cus, nil
|
||||
}
|
||||
|
||||
// 返回概率下的套装
|
||||
@ -166,8 +166,8 @@ func (s *modelTrade) GetSuitRandom(uid string) (suiteId int32) {
|
||||
}
|
||||
//获取玩家已有装备
|
||||
ec, suites := s.module.ModuleEquipment.GetActionableSuit(uid)
|
||||
if ec!=pb.ErrorCode_Success {
|
||||
s.module.Error("获取玩家已有装备:", log.Field{Key:"code",Value: ec})
|
||||
if ec != pb.ErrorCode_Success {
|
||||
s.module.Error("获取玩家已有装备:", log.Field{Key: "code", Value: ec})
|
||||
return
|
||||
}
|
||||
var ownerSuiteItems []*WeightItem
|
||||
|
@ -327,7 +327,9 @@ const (
|
||||
ErrorCode_SmithyLackLava ErrorCode = 4107 // 缺少熔岩
|
||||
ErrorCode_SmithyAtlasMaxLv ErrorCode = 4108 // 图鉴奖励满级
|
||||
ErrorCode_SmithyAtlasLackLv ErrorCode = 4109 // 图鉴奖励等级不足
|
||||
ErrorCode_SmithyNoFoundAtlas ErrorCode = 4110 // 没有找到图鉴数据
|
||||
ErrorCode_SmithyTaskNoFinished ErrorCode = 4110 //图鉴任务未完成
|
||||
ErrorCode_SmithyTaskReceived ErrorCode = 4111 //图鉴任务奖励已领
|
||||
ErrorCode_SmithyNoFoundAtlas ErrorCode = 4112 // 没有找到图鉴数据
|
||||
)
|
||||
|
||||
// Enum value maps for ErrorCode.
|
||||
@ -605,7 +607,9 @@ var (
|
||||
4107: "SmithyLackLava",
|
||||
4108: "SmithyAtlasMaxLv",
|
||||
4109: "SmithyAtlasLackLv",
|
||||
4110: "SmithyNoFoundAtlas",
|
||||
4110: "SmithyTaskNoFinished",
|
||||
4111: "SmithyTaskReceived",
|
||||
4112: "SmithyNoFoundAtlas",
|
||||
}
|
||||
ErrorCode_value = map[string]int32{
|
||||
"Success": 0,
|
||||
@ -880,7 +884,9 @@ var (
|
||||
"SmithyLackLava": 4107,
|
||||
"SmithyAtlasMaxLv": 4108,
|
||||
"SmithyAtlasLackLv": 4109,
|
||||
"SmithyNoFoundAtlas": 4110,
|
||||
"SmithyTaskNoFinished": 4110,
|
||||
"SmithyTaskReceived": 4111,
|
||||
"SmithyNoFoundAtlas": 4112,
|
||||
}
|
||||
)
|
||||
|
||||
@ -915,7 +921,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, 0xc7, 0x31, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||
0x6f, 0x2a, 0xfb, 0x31, 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,
|
||||
@ -1310,9 +1316,12 @@ var file_errorcode_proto_rawDesc = []byte{
|
||||
0x10, 0x8b, 0x20, 0x12, 0x15, 0x0a, 0x10, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x41, 0x74, 0x6c,
|
||||
0x61, 0x73, 0x4d, 0x61, 0x78, 0x4c, 0x76, 0x10, 0x8c, 0x20, 0x12, 0x16, 0x0a, 0x11, 0x53, 0x6d,
|
||||
0x69, 0x74, 0x68, 0x79, 0x41, 0x74, 0x6c, 0x61, 0x73, 0x4c, 0x61, 0x63, 0x6b, 0x4c, 0x76, 0x10,
|
||||
0x8d, 0x20, 0x12, 0x17, 0x0a, 0x12, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x4e, 0x6f, 0x46, 0x6f,
|
||||
0x75, 0x6e, 0x64, 0x41, 0x74, 0x6c, 0x61, 0x73, 0x10, 0x8e, 0x20, 0x42, 0x06, 0x5a, 0x04, 0x2e,
|
||||
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x8d, 0x20, 0x12, 0x19, 0x0a, 0x14, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x54, 0x61, 0x73, 0x6b,
|
||||
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0x8e, 0x20, 0x12, 0x17, 0x0a,
|
||||
0x12, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x65, 0x69,
|
||||
0x76, 0x65, 0x64, 0x10, 0x8f, 0x20, 0x12, 0x17, 0x0a, 0x12, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79,
|
||||
0x4e, 0x6f, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x41, 0x74, 0x6c, 0x61, 0x73, 0x10, 0x90, 0x20, 0x42,
|
||||
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
42
sys/configure/structs/Game.SmithyTask.go
Normal file
42
sys/configure/structs/Game.SmithyTask.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 GameSmithyTask struct {
|
||||
_dataMap map[int32]*GameSmithyTaskData
|
||||
_dataList []*GameSmithyTaskData
|
||||
}
|
||||
|
||||
func NewGameSmithyTask(_buf []map[string]interface{}) (*GameSmithyTask, error) {
|
||||
_dataList := make([]*GameSmithyTaskData, 0, len(_buf))
|
||||
dataMap := make(map[int32]*GameSmithyTaskData)
|
||||
for _, _ele_ := range _buf {
|
||||
if _v, err2 := DeserializeGameSmithyTaskData(_ele_); err2 != nil {
|
||||
return nil, err2
|
||||
} else {
|
||||
_dataList = append(_dataList, _v)
|
||||
dataMap[_v.Key] = _v
|
||||
}
|
||||
}
|
||||
return &GameSmithyTask{_dataList:_dataList, _dataMap:dataMap}, nil
|
||||
}
|
||||
|
||||
func (table *GameSmithyTask) GetDataMap() map[int32]*GameSmithyTaskData {
|
||||
return table._dataMap
|
||||
}
|
||||
|
||||
func (table *GameSmithyTask) GetDataList() []*GameSmithyTaskData {
|
||||
return table._dataList
|
||||
}
|
||||
|
||||
func (table *GameSmithyTask) Get(key int32) *GameSmithyTaskData {
|
||||
return table._dataMap[key]
|
||||
}
|
||||
|
||||
|
56
sys/configure/structs/Game.SmithyTaskData.go
Normal file
56
sys/configure/structs/Game.SmithyTaskData.go
Normal file
@ -0,0 +1,56 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
package cfg
|
||||
|
||||
import "errors"
|
||||
|
||||
type GameSmithyTaskData struct {
|
||||
Key int32
|
||||
IdList int32
|
||||
TaskDisplay string
|
||||
TypeId int32
|
||||
Reword []*Gameatn
|
||||
}
|
||||
|
||||
const TypeId_GameSmithyTaskData = -1483471039
|
||||
|
||||
func (*GameSmithyTaskData) GetTypeId() int32 {
|
||||
return -1483471039
|
||||
}
|
||||
|
||||
func (_v *GameSmithyTaskData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id_list"].(float64); !_ok_ { err = errors.New("id_list error"); return }; _v.IdList = int32(_tempNum_) }
|
||||
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["task_display"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.TaskDisplay error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.TaskDisplay, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type_id"].(float64); !_ok_ { err = errors.New("type_id error"); return }; _v.TypeId = int32(_tempNum_) }
|
||||
{
|
||||
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 DeserializeGameSmithyTaskData(_buf map[string]interface{}) (*GameSmithyTaskData, error) {
|
||||
v := &GameSmithyTaskData{}
|
||||
if err := v.Deserialize(_buf); err == nil {
|
||||
return v, nil
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user