diff --git a/bin/json/game_material.json b/bin/json/game_material.json
new file mode 100644
index 000000000..77e5eafcf
--- /dev/null
+++ b/bin/json/game_material.json
@@ -0,0 +1,434 @@
+[
+ {
+ "id": 1001,
+ "describe": {
+ "key": "hechengmoyao1001",
+ "text": "材料A+材料B"
+ },
+ "type": 1,
+ "material": [
+ {
+ "a": "item",
+ "t": "10001",
+ "n": 1
+ }
+ ],
+ "standard_yield": [
+ {
+ "a": "item",
+ "t": "100001",
+ "n": 3
+ }
+ ],
+ "low_yield": [
+ {
+ "a": "item",
+ "t": "100001",
+ "n": 1
+ }
+ ],
+ "high_yield": [
+ {
+ "a": "item",
+ "t": "100001",
+ "n": 7
+ }
+ ]
+ },
+ {
+ "id": 1002,
+ "describe": {
+ "key": "hechengmoyao1002",
+ "text": "材料A+材料B"
+ },
+ "type": 2,
+ "material": [
+ {
+ "a": "item",
+ "t": "10002",
+ "n": 1
+ }
+ ],
+ "standard_yield": [
+ {
+ "a": "item",
+ "t": "100002",
+ "n": 3
+ }
+ ],
+ "low_yield": [
+ {
+ "a": "item",
+ "t": "100002",
+ "n": 1
+ }
+ ],
+ "high_yield": [
+ {
+ "a": "item",
+ "t": "100002",
+ "n": 7
+ }
+ ]
+ },
+ {
+ "id": 1003,
+ "describe": {
+ "key": "hechengmoyao1003",
+ "text": "材料A+材料B"
+ },
+ "type": 3,
+ "material": [
+ {
+ "a": "item",
+ "t": "10003",
+ "n": 1
+ }
+ ],
+ "standard_yield": [
+ {
+ "a": "item",
+ "t": "100003",
+ "n": 3
+ }
+ ],
+ "low_yield": [
+ {
+ "a": "item",
+ "t": "100003",
+ "n": 1
+ }
+ ],
+ "high_yield": [
+ {
+ "a": "item",
+ "t": "100003",
+ "n": 7
+ }
+ ]
+ },
+ {
+ "id": 1004,
+ "describe": {
+ "key": "hechengmoyao1004",
+ "text": "材料A+材料B"
+ },
+ "type": 4,
+ "material": [
+ {
+ "a": "item",
+ "t": "10004",
+ "n": 1
+ }
+ ],
+ "standard_yield": [
+ {
+ "a": "item",
+ "t": "100004",
+ "n": 3
+ }
+ ],
+ "low_yield": [
+ {
+ "a": "item",
+ "t": "100004",
+ "n": 1
+ }
+ ],
+ "high_yield": [
+ {
+ "a": "item",
+ "t": "100004",
+ "n": 7
+ }
+ ]
+ },
+ {
+ "id": 1005,
+ "describe": {
+ "key": "hechengmoyao1005",
+ "text": "材料A+材料B"
+ },
+ "type": 1,
+ "material": [
+ {
+ "a": "item",
+ "t": "10005",
+ "n": 1
+ }
+ ],
+ "standard_yield": [
+ {
+ "a": "item",
+ "t": "100005",
+ "n": 3
+ }
+ ],
+ "low_yield": [
+ {
+ "a": "item",
+ "t": "100005",
+ "n": 1
+ }
+ ],
+ "high_yield": [
+ {
+ "a": "item",
+ "t": "100005",
+ "n": 7
+ }
+ ]
+ },
+ {
+ "id": 1006,
+ "describe": {
+ "key": "hechengmoyao1006",
+ "text": "材料A+材料B"
+ },
+ "type": 2,
+ "material": [
+ {
+ "a": "item",
+ "t": "10006",
+ "n": 1
+ }
+ ],
+ "standard_yield": [
+ {
+ "a": "item",
+ "t": "100006",
+ "n": 3
+ }
+ ],
+ "low_yield": [
+ {
+ "a": "item",
+ "t": "100006",
+ "n": 1
+ }
+ ],
+ "high_yield": [
+ {
+ "a": "item",
+ "t": "100006",
+ "n": 7
+ }
+ ]
+ },
+ {
+ "id": 1007,
+ "describe": {
+ "key": "hechengmoyao1007",
+ "text": "材料A+材料B"
+ },
+ "type": 3,
+ "material": [
+ {
+ "a": "item",
+ "t": "10007",
+ "n": 1
+ }
+ ],
+ "standard_yield": [
+ {
+ "a": "item",
+ "t": "100007",
+ "n": 3
+ }
+ ],
+ "low_yield": [
+ {
+ "a": "item",
+ "t": "100007",
+ "n": 1
+ }
+ ],
+ "high_yield": [
+ {
+ "a": "item",
+ "t": "100007",
+ "n": 7
+ }
+ ]
+ },
+ {
+ "id": 1008,
+ "describe": {
+ "key": "hechengmoyao1008",
+ "text": "材料A+材料B"
+ },
+ "type": 4,
+ "material": [
+ {
+ "a": "item",
+ "t": "10008",
+ "n": 1
+ }
+ ],
+ "standard_yield": [
+ {
+ "a": "item",
+ "t": "100008",
+ "n": 3
+ }
+ ],
+ "low_yield": [
+ {
+ "a": "item",
+ "t": "100008",
+ "n": 1
+ }
+ ],
+ "high_yield": [
+ {
+ "a": "item",
+ "t": "100008",
+ "n": 7
+ }
+ ]
+ },
+ {
+ "id": 1009,
+ "describe": {
+ "key": "hechengmoyao1009",
+ "text": "材料A+材料B"
+ },
+ "type": 1,
+ "material": [
+ {
+ "a": "item",
+ "t": "10009",
+ "n": 1
+ }
+ ],
+ "standard_yield": [
+ {
+ "a": "item",
+ "t": "100009",
+ "n": 3
+ }
+ ],
+ "low_yield": [
+ {
+ "a": "item",
+ "t": "100009",
+ "n": 1
+ }
+ ],
+ "high_yield": [
+ {
+ "a": "item",
+ "t": "100009",
+ "n": 7
+ }
+ ]
+ },
+ {
+ "id": 1010,
+ "describe": {
+ "key": "hechengmoyao1010",
+ "text": "材料A+材料B"
+ },
+ "type": 2,
+ "material": [
+ {
+ "a": "item",
+ "t": "10010",
+ "n": 1
+ }
+ ],
+ "standard_yield": [
+ {
+ "a": "item",
+ "t": "100010",
+ "n": 3
+ }
+ ],
+ "low_yield": [
+ {
+ "a": "item",
+ "t": "100010",
+ "n": 1
+ }
+ ],
+ "high_yield": [
+ {
+ "a": "item",
+ "t": "100010",
+ "n": 7
+ }
+ ]
+ },
+ {
+ "id": 1011,
+ "describe": {
+ "key": "hechengmoyao1011",
+ "text": "材料A+材料B"
+ },
+ "type": 3,
+ "material": [
+ {
+ "a": "item",
+ "t": "10011",
+ "n": 1
+ }
+ ],
+ "standard_yield": [
+ {
+ "a": "item",
+ "t": "100011",
+ "n": 3
+ }
+ ],
+ "low_yield": [
+ {
+ "a": "item",
+ "t": "100011",
+ "n": 1
+ }
+ ],
+ "high_yield": [
+ {
+ "a": "item",
+ "t": "100011",
+ "n": 7
+ }
+ ]
+ },
+ {
+ "id": 1012,
+ "describe": {
+ "key": "hechengmoyao1012",
+ "text": "材料A+材料B"
+ },
+ "type": 4,
+ "material": [
+ {
+ "a": "item",
+ "t": "10012",
+ "n": 1
+ }
+ ],
+ "standard_yield": [
+ {
+ "a": "item",
+ "t": "100012",
+ "n": 3
+ }
+ ],
+ "low_yield": [
+ {
+ "a": "item",
+ "t": "100012",
+ "n": 1
+ }
+ ],
+ "high_yield": [
+ {
+ "a": "item",
+ "t": "100012",
+ "n": 7
+ }
+ ]
+ }
+]
\ No newline at end of file
diff --git a/modules/items/api_potionsynthesis.go b/modules/items/api_potionsynthesis.go
new file mode 100644
index 000000000..09382b810
--- /dev/null
+++ b/modules/items/api_potionsynthesis.go
@@ -0,0 +1,71 @@
+package items
+
+import (
+ "go_dreamfactory/comm"
+ "go_dreamfactory/pb"
+ cfg "go_dreamfactory/sys/configure/structs"
+
+ "google.golang.org/protobuf/proto"
+)
+
+//参数校验
+func (this *apiComp) PotionSynthesisCheck(session comm.IUserSession, req *pb.ItemsPotionSynthesisReq) (code pb.ErrorCode) {
+
+ return
+}
+
+//魔药合成
+func (this *apiComp) PotionSynthesis(session comm.IUserSession, req *pb.ItemsPotionSynthesisReq) (code pb.ErrorCode, data proto.Message) {
+ var (
+ configure *cfg.GamePotionsData
+ need []*cfg.Gameatn
+ give []*cfg.Gameatn
+ err error
+ )
+ if configure, err = this.module.configure.GetMaterialConfigure(req.Id); err != nil {
+ code = pb.ErrorCode_ConfigNoFound
+ return
+ }
+ need = make([]*cfg.Gameatn, len(configure.Material))
+ for i, v := range configure.Material {
+ need[i] = &cfg.Gameatn{
+ A: v.A,
+ T: v.T,
+ N: v.N * req.Num,
+ }
+ }
+ if code = this.module.ConsumeRes(session, configure.Material, true); code != pb.ErrorCode_Success {
+ return
+ }
+ give = make([]*cfg.Gameatn, 0)
+ if req.Succnum <= 30 {
+ for _, v := range configure.LowYield {
+ give = append(give, &cfg.Gameatn{
+ A: v.A,
+ T: v.T,
+ N: v.N * req.Num,
+ })
+ }
+ } else if req.Succnum <= 60 {
+ for _, v := range configure.StandardYield {
+ give = append(give, &cfg.Gameatn{
+ A: v.A,
+ T: v.T,
+ N: v.N * req.Num,
+ })
+ }
+ } else {
+ for _, v := range configure.HighYield {
+ give = append(give, &cfg.Gameatn{
+ A: v.A,
+ T: v.T,
+ N: v.N * req.Num,
+ })
+ }
+ }
+ if code = this.module.DispenseRes(session, give, true); code != pb.ErrorCode_Success {
+ return
+ }
+ session.SendMsg(string(this.module.GetType()), "potionsynthesis", &pb.ItemsPotionSynthesisResp{Succ: true, Id: req.Id, Num: req.Num})
+ return
+}
diff --git a/modules/items/configure.go b/modules/items/configure.go
index a13380715..d890d9309 100644
--- a/modules/items/configure.go
+++ b/modules/items/configure.go
@@ -11,7 +11,9 @@ import (
)
const (
- game_item = "game_item.json"
+ game_item = "game_item.json"
+ game_material = "game_material.json"
+
// game_propsgroup = "game_propsgroup.json"
// game_propsgrouplist = "game_propsgrouplist.json"
)
@@ -30,6 +32,7 @@ func (this *ConfigureComp) Init(service core.IService, module core.IModule, comp
this.module = module.(*Items)
// this.propsgroup = make(map[int32][]*cfg.GamePropsgroupData)
err = this.LoadConfigure(game_item, cfg.NewGameItem)
+ err = this.LoadConfigure(game_material, cfg.NewGamePotions)
// err = configure.RegisterConfigure(game_propsgroup, cfg.NewGamePropsgroup, func() {
// if v, err := this.GetConfigure(game_propsgroup); err == nil {
// if configure, ok := v.(*cfg.GamePropsgroup); ok {
@@ -160,3 +163,22 @@ func (this *ConfigureComp) GetchallengeData(buy int) (result *cfg.Gameatn) {
// }
// return
// }
+
+//读取物品配置
+func (this *ConfigureComp) GetMaterialConfigure(id int32) (configure *cfg.GamePotionsData, err error) {
+ var (
+ v interface{}
+ ok bool
+ )
+ if v, err = this.GetConfigure(game_item); err != nil {
+ this.module.Errorf("err:%v", err)
+ return
+ } else {
+ if configure, ok = v.(*cfg.GamePotions).GetDataMap()[id]; !ok {
+ err = fmt.Errorf("no found Material:%d configure", id)
+ this.module.Errorf("err:%v", err)
+ return
+ }
+ }
+ return
+}
diff --git a/pb/items_msg.pb.go b/pb/items_msg.pb.go
index 8576bc5ec..ccbae8f2a 100644
--- a/pb/items_msg.pb.go
+++ b/pb/items_msg.pb.go
@@ -969,6 +969,134 @@ func (*ItemsRefreshUnifiedTicketResp) Descriptor() ([]byte, []int) {
return file_items_items_msg_proto_rawDescGZIP(), []int{16}
}
+//魔药合成请求
+type ItemsPotionSynthesisReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` //配方id
+ Succnum int32 `protobuf:"varint,2,opt,name=succnum,proto3" json:"succnum"` //成功数量
+ Num int32 `protobuf:"varint,3,opt,name=num,proto3" json:"num"` //炼制数量
+}
+
+func (x *ItemsPotionSynthesisReq) Reset() {
+ *x = ItemsPotionSynthesisReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_items_items_msg_proto_msgTypes[17]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ItemsPotionSynthesisReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ItemsPotionSynthesisReq) ProtoMessage() {}
+
+func (x *ItemsPotionSynthesisReq) ProtoReflect() protoreflect.Message {
+ mi := &file_items_items_msg_proto_msgTypes[17]
+ 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 ItemsPotionSynthesisReq.ProtoReflect.Descriptor instead.
+func (*ItemsPotionSynthesisReq) Descriptor() ([]byte, []int) {
+ return file_items_items_msg_proto_rawDescGZIP(), []int{17}
+}
+
+func (x *ItemsPotionSynthesisReq) GetId() int32 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *ItemsPotionSynthesisReq) GetSuccnum() int32 {
+ if x != nil {
+ return x.Succnum
+ }
+ return 0
+}
+
+func (x *ItemsPotionSynthesisReq) GetNum() int32 {
+ if x != nil {
+ return x.Num
+ }
+ return 0
+}
+
+//魔药合成请求 回应
+type ItemsPotionSynthesisResp struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Succ bool `protobuf:"varint,1,opt,name=succ,proto3" json:"succ"`
+ Id int32 `protobuf:"varint,2,opt,name=id,proto3" json:"id"` //配方id
+ Num int32 `protobuf:"varint,3,opt,name=num,proto3" json:"num"` //炼制数量
+}
+
+func (x *ItemsPotionSynthesisResp) Reset() {
+ *x = ItemsPotionSynthesisResp{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_items_items_msg_proto_msgTypes[18]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ItemsPotionSynthesisResp) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ItemsPotionSynthesisResp) ProtoMessage() {}
+
+func (x *ItemsPotionSynthesisResp) ProtoReflect() protoreflect.Message {
+ mi := &file_items_items_msg_proto_msgTypes[18]
+ 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 ItemsPotionSynthesisResp.ProtoReflect.Descriptor instead.
+func (*ItemsPotionSynthesisResp) Descriptor() ([]byte, []int) {
+ return file_items_items_msg_proto_rawDescGZIP(), []int{18}
+}
+
+func (x *ItemsPotionSynthesisResp) GetSucc() bool {
+ if x != nil {
+ return x.Succ
+ }
+ return false
+}
+
+func (x *ItemsPotionSynthesisResp) GetId() int32 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *ItemsPotionSynthesisResp) GetNum() int32 {
+ if x != nil {
+ return x.Num
+ }
+ return 0
+}
+
var File_items_items_msg_proto protoreflect.FileDescriptor
var file_items_items_msg_proto_rawDesc = []byte{
@@ -1058,8 +1186,18 @@ var file_items_items_msg_proto_rawDesc = []byte{
0x68, 0x55, 0x6e, 0x69, 0x66, 0x69, 0x65, 0x64, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65,
0x71, 0x22, 0x1f, 0x0a, 0x1d, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73,
0x68, 0x55, 0x6e, 0x69, 0x66, 0x69, 0x65, 0x64, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65,
- 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
- 0x6f, 0x33,
+ 0x73, 0x70, 0x22, 0x55, 0x0a, 0x17, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x50, 0x6f, 0x74, 0x69, 0x6f,
+ 0x6e, 0x53, 0x79, 0x6e, 0x74, 0x68, 0x65, 0x73, 0x69, 0x73, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a,
+ 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a,
+ 0x07, 0x73, 0x75, 0x63, 0x63, 0x6e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07,
+ 0x73, 0x75, 0x63, 0x63, 0x6e, 0x75, 0x6d, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d, 0x18, 0x03,
+ 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x22, 0x50, 0x0a, 0x18, 0x49, 0x74, 0x65,
+ 0x6d, 0x73, 0x50, 0x6f, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x79, 0x6e, 0x74, 0x68, 0x65, 0x73, 0x69,
+ 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x75, 0x63, 0x63, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x08, 0x52, 0x04, 0x73, 0x75, 0x63, 0x63, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d,
+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x42, 0x06, 0x5a, 0x04, 0x2e,
+ 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -1074,7 +1212,7 @@ func file_items_items_msg_proto_rawDescGZIP() []byte {
return file_items_items_msg_proto_rawDescData
}
-var file_items_items_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 17)
+var file_items_items_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 19)
var file_items_items_msg_proto_goTypes = []interface{}{
(*ItemsGetlistReq)(nil), // 0: ItemsGetlistReq
(*ItemsGetlistResp)(nil), // 1: ItemsGetlistResp
@@ -1093,13 +1231,15 @@ var file_items_items_msg_proto_goTypes = []interface{}{
(*ItemsBuyUnifiedTicketResp)(nil), // 14: ItemsBuyUnifiedTicketResp
(*ItemsRefreshUnifiedTicketReq)(nil), // 15: ItemsRefreshUnifiedTicketReq
(*ItemsRefreshUnifiedTicketResp)(nil), // 16: ItemsRefreshUnifiedTicketResp
- (*DB_UserItemData)(nil), // 17: DB_UserItemData
- (*UserAssets)(nil), // 18: UserAssets
+ (*ItemsPotionSynthesisReq)(nil), // 17: ItemsPotionSynthesisReq
+ (*ItemsPotionSynthesisResp)(nil), // 18: ItemsPotionSynthesisResp
+ (*DB_UserItemData)(nil), // 19: DB_UserItemData
+ (*UserAssets)(nil), // 20: UserAssets
}
var file_items_items_msg_proto_depIdxs = []int32{
- 17, // 0: ItemsGetlistResp.Grids:type_name -> DB_UserItemData
- 17, // 1: ItemsChangePush.Grids:type_name -> DB_UserItemData
- 18, // 2: ItemsBuyPhysicalResp.asets:type_name -> UserAssets
+ 19, // 0: ItemsGetlistResp.Grids:type_name -> DB_UserItemData
+ 19, // 1: ItemsChangePush.Grids:type_name -> DB_UserItemData
+ 20, // 2: ItemsBuyPhysicalResp.asets:type_name -> UserAssets
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
@@ -1319,6 +1459,30 @@ func file_items_items_msg_proto_init() {
return nil
}
}
+ file_items_items_msg_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ItemsPotionSynthesisReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_items_items_msg_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ItemsPotionSynthesisResp); 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{
@@ -1326,7 +1490,7 @@ func file_items_items_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_items_items_msg_proto_rawDesc,
NumEnums: 0,
- NumMessages: 17,
+ NumMessages: 19,
NumExtensions: 0,
NumServices: 0,
},
diff --git a/sys/configure/structs/Game.Potions.go b/sys/configure/structs/Game.Potions.go
new file mode 100644
index 000000000..66ab4a615
--- /dev/null
+++ b/sys/configure/structs/Game.Potions.go
@@ -0,0 +1,42 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+package cfg
+
+type GamePotions struct {
+ _dataMap map[int32]*GamePotionsData
+ _dataList []*GamePotionsData
+}
+
+func NewGamePotions(_buf []map[string]interface{}) (*GamePotions, error) {
+ _dataList := make([]*GamePotionsData, 0, len(_buf))
+ dataMap := make(map[int32]*GamePotionsData)
+ for _, _ele_ := range _buf {
+ if _v, err2 := DeserializeGamePotionsData(_ele_); err2 != nil {
+ return nil, err2
+ } else {
+ _dataList = append(_dataList, _v)
+ dataMap[_v.Id] = _v
+ }
+ }
+ return &GamePotions{_dataList:_dataList, _dataMap:dataMap}, nil
+}
+
+func (table *GamePotions) GetDataMap() map[int32]*GamePotionsData {
+ return table._dataMap
+}
+
+func (table *GamePotions) GetDataList() []*GamePotionsData {
+ return table._dataList
+}
+
+func (table *GamePotions) Get(key int32) *GamePotionsData {
+ return table._dataMap[key]
+}
+
+
diff --git a/sys/configure/structs/Game.PotionsData.go b/sys/configure/structs/Game.PotionsData.go
new file mode 100644
index 000000000..9016b7609
--- /dev/null
+++ b/sys/configure/structs/Game.PotionsData.go
@@ -0,0 +1,188 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+package cfg
+
+import "errors"
+
+type GamePotionsData struct {
+ Id int32
+ Describe string
+ Type int32
+ Material []*Gameatn
+ StandardYield []*Gameatn
+ LowYield []*Gameatn
+ HighYield []*Gameatn
+}
+
+const TypeId_GamePotionsData = 844054798
+
+func (*GamePotionsData) GetTypeId() int32 {
+ return 844054798
+}
+
+func (_v *GamePotionsData) 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["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["type"].(float64); !_ok_ {
+ err = errors.New("type error")
+ return
+ }
+ _v.Type = int32(_tempNum_)
+ }
+ {
+ var _arr_ []interface{}
+ var _ok_ bool
+ if _arr_, _ok_ = _buf["material"].([]interface{}); !_ok_ {
+ err = errors.New("material error")
+ return
+ }
+
+ _v.Material = 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.Material = append(_v.Material, _list_v_)
+ }
+ }
+
+ {
+ var _arr_ []interface{}
+ var _ok_ bool
+ if _arr_, _ok_ = _buf["standard_yield"].([]interface{}); !_ok_ {
+ err = errors.New("standard_yield error")
+ return
+ }
+
+ _v.StandardYield = 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.StandardYield = append(_v.StandardYield, _list_v_)
+ }
+ }
+
+ {
+ var _arr_ []interface{}
+ var _ok_ bool
+ if _arr_, _ok_ = _buf["low_yield"].([]interface{}); !_ok_ {
+ err = errors.New("low_yield error")
+ return
+ }
+
+ _v.LowYield = 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.LowYield = append(_v.LowYield, _list_v_)
+ }
+ }
+
+ {
+ var _arr_ []interface{}
+ var _ok_ bool
+ if _arr_, _ok_ = _buf["high_yield"].([]interface{}); !_ok_ {
+ err = errors.New("high_yield error")
+ return
+ }
+
+ _v.HighYield = 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.HighYield = append(_v.HighYield, _list_v_)
+ }
+ }
+
+ return
+}
+
+func DeserializeGamePotionsData(_buf map[string]interface{}) (*GamePotionsData, error) {
+ v := &GamePotionsData{}
+ if err := v.Deserialize(_buf); err == nil {
+ return v, nil
+ } else {
+ return nil, err
+ }
+}