//------------------------------------------------------------------------------
// <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 GameEquipData struct {
    Id string
    EquipId int32
    Name string
    AtlasId string
    Suittype int32
    Suitintr string
    Pos int32
    InitLv int32
    Color int32
    Effects string
    Leadlibrary int32
    Addattrnum []int32
    Addattrnump []int32
    Addlibrary int32
    Ico string
    UseSkip int32
    Sale []*Gameatn
    SmithySale []*Gameatn
    Salecoef float32
}

const TypeId_GameEquipData = -1514145538

func (*GameEquipData) GetTypeId() int32 {
    return -1514145538
}

func (_v *GameEquipData)Deserialize(_buf map[string]interface{}) (err error) {
    { var _ok_ bool; if _v.Id, _ok_ = _buf["id"].(string); !_ok_ { err = errors.New("id error"); return } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["equip_id"].(float64); !_ok_ { err = errors.New("equip_id error"); return }; _v.EquipId = 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; if _v.AtlasId, _ok_ = _buf["atlas_id"].(string); !_ok_ { err = errors.New("atlas_id error"); return } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["suittype"].(float64); !_ok_ { err = errors.New("suittype error"); return }; _v.Suittype = int32(_tempNum_) }
    {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["suitintr"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Suitintr error"); return };  { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Suitintr, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["pos"].(float64); !_ok_ { err = errors.New("pos error"); return }; _v.Pos = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["initLv"].(float64); !_ok_ { err = errors.New("initLv error"); return }; _v.InitLv = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["color"].(float64); !_ok_ { err = errors.New("color error"); return }; _v.Color = int32(_tempNum_) }
    { var _ok_ bool; if _v.Effects, _ok_ = _buf["Effects"].(string); !_ok_ { err = errors.New("Effects error"); return } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["leadlibrary"].(float64); !_ok_ { err = errors.New("leadlibrary error"); return }; _v.Leadlibrary = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["addattrnum"].([]interface{}); !_ok_ { err = errors.New("addattrnum error"); return }

                _v.Addattrnum = make([]int32, 0, len(_arr_))
                
                for _, _e_ := range _arr_ {
                    var _list_v_ int32
                    { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
                    _v.Addattrnum = append(_v.Addattrnum, _list_v_)
                }
            }

     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["addattrnump"].([]interface{}); !_ok_ { err = errors.New("addattrnump error"); return }

                _v.Addattrnump = make([]int32, 0, len(_arr_))
                
                for _, _e_ := range _arr_ {
                    var _list_v_ int32
                    { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
                    _v.Addattrnump = append(_v.Addattrnump, _list_v_)
                }
            }

    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["addlibrary"].(float64); !_ok_ { err = errors.New("addlibrary error"); return }; _v.Addlibrary = int32(_tempNum_) }
    { var _ok_ bool; if _v.Ico, _ok_ = _buf["ico"].(string); !_ok_ { err = errors.New("ico error"); return } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["use_skip"].(float64); !_ok_ { err = errors.New("use_skip error"); return }; _v.UseSkip = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["sale"].([]interface{}); !_ok_ { err = errors.New("sale error"); return }

                _v.Sale = 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.Sale = append(_v.Sale, _list_v_)
                }
            }

     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["smithy_sale"].([]interface{}); !_ok_ { err = errors.New("smithy_sale error"); return }

                _v.SmithySale = 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.SmithySale = append(_v.SmithySale, _list_v_)
                }
            }

    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["salecoef"].(float64); !_ok_ { err = errors.New("salecoef error"); return }; _v.Salecoef = float32(_tempNum_) }
    return
}

func DeserializeGameEquipData(_buf map[string]interface{}) (*GameEquipData, error) {
    v := &GameEquipData{}
    if err := v.Deserialize(_buf); err == nil {
        return v, nil
    } else {
        return nil, err
    }
}
