上传彩蛋模块

This commit is contained in:
liwei1dao 2023-11-02 14:35:04 +08:00
parent 8ba9dff155
commit 7bc8592e27
15 changed files with 750 additions and 9 deletions

View File

@ -10925,7 +10925,7 @@
"hid": "54015",
"name": {
"key": "hero_main_name_54015",
"text": "伪装老太太"
"text": "受伤的老太太"
},
"star": 3,
"color": 2,
@ -10996,7 +10996,7 @@
"expitemnum": 7,
"herointr": {
"key": "hero_main_herointr_140",
"text": "传说中的守护者“伪装老太太”,拥有不俗的战斗能力"
"text": "传说中的守护者“受伤的老太太”,拥有不俗的战斗能力"
}
},
{

View File

@ -121,6 +121,7 @@ const (
ModuleGameInvite core.M_Modules = "gameinvite" //游戏邀请
ModuleCanineRabbit core.M_Modules = "caninerabbit" //犬兔游戏
ModuleIsLand core.M_Modules = "island" //海岛探险
ModuleEgghunt core.M_Modules = "egghunt" //彩蛋
)
// 数据表名定义处
@ -412,6 +413,8 @@ const (
TableIsLand = "island"
//海岛
TableIsLandHero = "islandhero"
//彩蛋
TableEgghunt = "egghunt"
)
// RPC服务接口定义处

17
modules/egghunt/api.go Normal file
View File

@ -0,0 +1,17 @@
package egghunt
import (
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
type apiComp struct {
modules.MCompGate
module *Egghunt
}
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
_ = this.MCompGate.Init(service, module, comp, options)
this.module = module.(*Egghunt)
return
}

View File

@ -0,0 +1,37 @@
package egghunt
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
)
func (this *apiComp) AwardCheck(session comm.IUserSession, req *pb.EgghuntAwardReq) (errdata *pb.ErrorData) {
return
}
func (this *apiComp) Award(session comm.IUserSession, req *pb.EgghuntAwardReq) (errdata *pb.ErrorData) {
var (
conf *cfg.GameRepeatAllData
atno []*pb.UserAtno
err error
)
if errdata = this.AwardCheck(session, req); errdata != nil {
return
}
if conf, err = this.module.configure.getGameRepeatAllData(req.Id); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Message: err.Error(),
}
return
}
if errdata, atno = this.module.DispenseAtno(session, conf.Reward, true); errdata != nil {
return
}
session.SendMsg(string(this.module.GetType()), "info", &pb.EgghuntAwardResp{Id: req.Id, Award: atno})
return
}

View File

@ -0,0 +1,41 @@
package egghunt
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
)
const (
game_repeatall = "game_repeatall.json"
)
type configureComp struct {
modules.MCompConfigure
module *Egghunt
}
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.LoadConfigure(game_repeatall, cfg.NewGameRepeatAll)
return
}
// 读取装备出售系数配置
func (this *configureComp) getGameRepeatAllData(id int32) (result *cfg.GameRepeatAllData, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_repeatall); err != nil {
this.module.Errorf("err:%v", err)
return
} else {
if result, ok = v.(*cfg.GameRepeatAll).GetDataMap()[id]; !ok {
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_repeatall, id)
return
}
}
return
}

45
modules/egghunt/model.go Normal file
View File

@ -0,0 +1,45 @@
package egghunt
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/mgo"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
)
type modelComp struct {
modules.MCompModel
module *Egghunt
}
func (this *modelComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.MCompModel.Init(service, module, comp, options)
this.TableName = comm.TableEgghunt
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return
}
// 获取用户全部的埋点数据
func (this *modelComp) getModel(uid string) (info *pb.DBDColor, err error) {
info = &pb.DBDColor{}
if err = this.Get(uid, info); err != nil && err != mgo.MongodbNil {
this.module.Errorln(err)
return
}
if err == mgo.MongodbNil {
info = &pb.DBDColor{
Id: primitive.NewObjectID().Hex(),
Uid: uid,
Integral: 0,
}
err = this.Add(uid, info)
}
return
}

49
modules/egghunt/module.go Normal file
View File

@ -0,0 +1,49 @@
package egghunt
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
func NewModule() core.IModule {
m := new(Egghunt)
return m
}
/*
模块名称:猜颜色
*/
type Egghunt struct {
modules.ModuleBase
service comm.IService
api *apiComp
configure *configureComp
model *modelComp
}
// 模块名
func (this *Egghunt) GetType() core.M_Modules {
return comm.ModuleEgghunt
}
// 模块初始化接口 注册用户创建角色事件
func (this *Egghunt) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
this.service = service.(comm.IService)
return
}
func (this *Egghunt) Start() (err error) {
if err = this.ModuleBase.Start(); err != nil {
return
}
return
}
func (this *Egghunt) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
this.model = this.RegisterComp(new(modelComp)).(*modelComp)
}

151
pb/egghunt_db.pb.go Normal file
View File

@ -0,0 +1,151 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: egghunt/egghunt_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 DBEgghunt struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"`
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` //用户ID
}
func (x *DBEgghunt) Reset() {
*x = DBEgghunt{}
if protoimpl.UnsafeEnabled {
mi := &file_egghunt_egghunt_db_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DBEgghunt) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DBEgghunt) ProtoMessage() {}
func (x *DBEgghunt) ProtoReflect() protoreflect.Message {
mi := &file_egghunt_egghunt_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 DBEgghunt.ProtoReflect.Descriptor instead.
func (*DBEgghunt) Descriptor() ([]byte, []int) {
return file_egghunt_egghunt_db_proto_rawDescGZIP(), []int{0}
}
func (x *DBEgghunt) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *DBEgghunt) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
var File_egghunt_egghunt_db_proto protoreflect.FileDescriptor
var file_egghunt_egghunt_db_proto_rawDesc = []byte{
0x0a, 0x18, 0x65, 0x67, 0x67, 0x68, 0x75, 0x6e, 0x74, 0x2f, 0x65, 0x67, 0x67, 0x68, 0x75, 0x6e,
0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2d, 0x0a, 0x09, 0x44, 0x42,
0x45, 0x67, 0x67, 0x68, 0x75, 0x6e, 0x74, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_egghunt_egghunt_db_proto_rawDescOnce sync.Once
file_egghunt_egghunt_db_proto_rawDescData = file_egghunt_egghunt_db_proto_rawDesc
)
func file_egghunt_egghunt_db_proto_rawDescGZIP() []byte {
file_egghunt_egghunt_db_proto_rawDescOnce.Do(func() {
file_egghunt_egghunt_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_egghunt_egghunt_db_proto_rawDescData)
})
return file_egghunt_egghunt_db_proto_rawDescData
}
var file_egghunt_egghunt_db_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_egghunt_egghunt_db_proto_goTypes = []interface{}{
(*DBEgghunt)(nil), // 0: DBEgghunt
}
var file_egghunt_egghunt_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_egghunt_egghunt_db_proto_init() }
func file_egghunt_egghunt_db_proto_init() {
if File_egghunt_egghunt_db_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_egghunt_egghunt_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBEgghunt); 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_egghunt_egghunt_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_egghunt_egghunt_db_proto_goTypes,
DependencyIndexes: file_egghunt_egghunt_db_proto_depIdxs,
MessageInfos: file_egghunt_egghunt_db_proto_msgTypes,
}.Build()
File_egghunt_egghunt_db_proto = out.File
file_egghunt_egghunt_db_proto_rawDesc = nil
file_egghunt_egghunt_db_proto_goTypes = nil
file_egghunt_egghunt_db_proto_depIdxs = nil
}

217
pb/egghunt_msg.pb.go Normal file
View File

@ -0,0 +1,217 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: egghunt/egghunt_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 EgghuntAwardReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id"`
}
func (x *EgghuntAwardReq) Reset() {
*x = EgghuntAwardReq{}
if protoimpl.UnsafeEnabled {
mi := &file_egghunt_egghunt_msg_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EgghuntAwardReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EgghuntAwardReq) ProtoMessage() {}
func (x *EgghuntAwardReq) ProtoReflect() protoreflect.Message {
mi := &file_egghunt_egghunt_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 EgghuntAwardReq.ProtoReflect.Descriptor instead.
func (*EgghuntAwardReq) Descriptor() ([]byte, []int) {
return file_egghunt_egghunt_msg_proto_rawDescGZIP(), []int{0}
}
func (x *EgghuntAwardReq) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
type EgghuntAwardResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id"`
Award []*UserAtno `protobuf:"bytes,3,rep,name=award,proto3" json:"award"` //获取资源
}
func (x *EgghuntAwardResp) Reset() {
*x = EgghuntAwardResp{}
if protoimpl.UnsafeEnabled {
mi := &file_egghunt_egghunt_msg_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EgghuntAwardResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EgghuntAwardResp) ProtoMessage() {}
func (x *EgghuntAwardResp) ProtoReflect() protoreflect.Message {
mi := &file_egghunt_egghunt_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 EgghuntAwardResp.ProtoReflect.Descriptor instead.
func (*EgghuntAwardResp) Descriptor() ([]byte, []int) {
return file_egghunt_egghunt_msg_proto_rawDescGZIP(), []int{1}
}
func (x *EgghuntAwardResp) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *EgghuntAwardResp) GetAward() []*UserAtno {
if x != nil {
return x.Award
}
return nil
}
var File_egghunt_egghunt_msg_proto protoreflect.FileDescriptor
var file_egghunt_egghunt_msg_proto_rawDesc = []byte{
0x0a, 0x19, 0x65, 0x67, 0x67, 0x68, 0x75, 0x6e, 0x74, 0x2f, 0x65, 0x67, 0x67, 0x68, 0x75, 0x6e,
0x74, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f, 0x6d,
0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x21, 0x0a, 0x0f, 0x45, 0x67, 0x67, 0x68, 0x75,
0x6e, 0x74, 0x41, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x43, 0x0a, 0x10, 0x45, 0x67,
0x67, 0x68, 0x75, 0x6e, 0x74, 0x41, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x0e,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f,
0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e,
0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x42,
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_egghunt_egghunt_msg_proto_rawDescOnce sync.Once
file_egghunt_egghunt_msg_proto_rawDescData = file_egghunt_egghunt_msg_proto_rawDesc
)
func file_egghunt_egghunt_msg_proto_rawDescGZIP() []byte {
file_egghunt_egghunt_msg_proto_rawDescOnce.Do(func() {
file_egghunt_egghunt_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_egghunt_egghunt_msg_proto_rawDescData)
})
return file_egghunt_egghunt_msg_proto_rawDescData
}
var file_egghunt_egghunt_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_egghunt_egghunt_msg_proto_goTypes = []interface{}{
(*EgghuntAwardReq)(nil), // 0: EgghuntAwardReq
(*EgghuntAwardResp)(nil), // 1: EgghuntAwardResp
(*UserAtno)(nil), // 2: UserAtno
}
var file_egghunt_egghunt_msg_proto_depIdxs = []int32{
2, // 0: EgghuntAwardResp.award:type_name -> UserAtno
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_egghunt_egghunt_msg_proto_init() }
func file_egghunt_egghunt_msg_proto_init() {
if File_egghunt_egghunt_msg_proto != nil {
return
}
file_comm_proto_init()
if !protoimpl.UnsafeEnabled {
file_egghunt_egghunt_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EgghuntAwardReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_egghunt_egghunt_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EgghuntAwardResp); 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_egghunt_egghunt_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_egghunt_egghunt_msg_proto_goTypes,
DependencyIndexes: file_egghunt_egghunt_msg_proto_depIdxs,
MessageInfos: file_egghunt_egghunt_msg_proto_msgTypes,
}.Build()
File_egghunt_egghunt_msg_proto = out.File
file_egghunt_egghunt_msg_proto_rawDesc = nil
file_egghunt_egghunt_msg_proto_goTypes = nil
file_egghunt_egghunt_msg_proto_depIdxs = nil
}

View File

@ -21,6 +21,7 @@ import (
"go_dreamfactory/modules/dcolor"
"go_dreamfactory/modules/dispatch"
"go_dreamfactory/modules/dragon"
"go_dreamfactory/modules/egghunt"
"go_dreamfactory/modules/enchant"
"go_dreamfactory/modules/entertainment"
"go_dreamfactory/modules/equipment"
@ -182,6 +183,7 @@ func main() {
gameinvite.NewModule(),
caninerabbit.NewModule(),
island.NewModule(),
egghunt.NewModule(),
)
}

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

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 GameTDLvData struct {
TdLv int32
Exp int32
}
const TypeId_GameTDLvData = 648422720
func (*GameTDLvData) GetTypeId() int32 {
return 648422720
}
func (_v *GameTDLvData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["td_lv"].(float64); !_ok_ { err = errors.New("td_lv error"); return }; _v.TdLv = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["exp"].(float64); !_ok_ { err = errors.New("exp error"); return }; _v.Exp = int32(_tempNum_) }
return
}
func DeserializeGameTDLvData(_buf map[string]interface{}) (*GameTDLvData, error) {
v := &GameTDLvData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

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

View File

@ -0,0 +1,51 @@
//------------------------------------------------------------------------------
// <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 GameTDWeaponData struct {
Id int32
Name string
Describe string
Sak int32
AtkSpeed int32
WeaponType int32
FlySpeed float32
Data int32
Pro int32
}
const TypeId_GameTDWeaponData = -310580526
func (*GameTDWeaponData) GetTypeId() int32 {
return -310580526
}
func (_v *GameTDWeaponData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["name"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Name error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Name, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["describe"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Describe error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Describe, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["sak"].(float64); !_ok_ { err = errors.New("sak error"); return }; _v.Sak = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["atk_speed"].(float64); !_ok_ { err = errors.New("atk_speed error"); return }; _v.AtkSpeed = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["weapon_type"].(float64); !_ok_ { err = errors.New("weapon_type error"); return }; _v.WeaponType = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["fly_speed"].(float64); !_ok_ { err = errors.New("fly_speed error"); return }; _v.FlySpeed = float32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["data"].(float64); !_ok_ { err = errors.New("data error"); return }; _v.Data = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["pro"].(float64); !_ok_ { err = errors.New("pro error"); return }; _v.Pro = int32(_tempNum_) }
return
}
func DeserializeGameTDWeaponData(_buf map[string]interface{}) (*GameTDWeaponData, error) {
v := &GameTDWeaponData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View File

@ -283,12 +283,13 @@ type Tables struct {
RepeatAll *GameRepeatAll
TDMonster *GameTDMonster
TDMonsterAppear *GameTDMonsterAppear
TDLv *GameTDLv
TDWeapon *GameTDWeapon
PuggsyIsLand *GamePuggsyIsLand
PuggsyEvent *GamePuggsyEvent
PuggsyFight *GamePuggsyFight
PuggsyScore *GamePuggsyScore
PuggsySkill *GamePuggsySkill
PuggsyPasscheck *GamePuggsyPasscheck
}
func NewTables(loader JsonLoader) (*Tables, error) {
@ -1928,6 +1929,18 @@ func NewTables(loader JsonLoader) (*Tables, error) {
if tables.TDMonsterAppear, err = NewGameTDMonsterAppear(buf) ; err != nil {
return nil, err
}
if buf, err = loader("game_tdlv") ; err != nil {
return nil, err
}
if tables.TDLv, err = NewGameTDLv(buf) ; err != nil {
return nil, err
}
if buf, err = loader("game_tdweapon") ; err != nil {
return nil, err
}
if tables.TDWeapon, err = NewGameTDWeapon(buf) ; err != nil {
return nil, err
}
if buf, err = loader("game_puggsyisland") ; err != nil {
return nil, err
}
@ -1958,11 +1971,5 @@ func NewTables(loader JsonLoader) (*Tables, error) {
if tables.PuggsySkill, err = NewGamePuggsySkill(buf) ; err != nil {
return nil, err
}
if buf, err = loader("game_puggsypasscheck") ; err != nil {
return nil, err
}
if tables.PuggsyPasscheck, err = NewGamePuggsyPasscheck(buf) ; err != nil {
return nil, err
}
return tables, nil
}