//------------------------------------------------------------------------------
// <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 GameRobotData struct {
    Robotid int32
    Icon string
    Lvshow int32
    Name string
    Hero1 int32
    Lv1 int32
    Star1 int32
    Equip1 []int32
    Hero2 int32
    Lv2 int32
    Star2 int32
    Equip2 []int32
    Hero3 int32
    Lv3 int32
    Star3 int32
    Equip3 []int32
    Hero4 int32
    Lv4 int32
    Star4 int32
    Equip4 []int32
    Hero5 int32
    Lv5 int32
    Star5 int32
    Equip5 []int32
}

const TypeId_GameRobotData = 2060865080

func (*GameRobotData) GetTypeId() int32 {
    return 2060865080
}

func (_v *GameRobotData)Deserialize(_buf map[string]interface{}) (err error) {
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["robotid"].(float64); !_ok_ { err = errors.New("robotid error"); return }; _v.Robotid = int32(_tempNum_) }
    { var _ok_ bool; if _v.Icon, _ok_ = _buf["icon"].(string); !_ok_ { err = errors.New("icon error"); return } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lvshow"].(float64); !_ok_ { err = errors.New("lvshow error"); return }; _v.Lvshow = int32(_tempNum_) }
    { var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["hero1"].(float64); !_ok_ { err = errors.New("hero1 error"); return }; _v.Hero1 = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lv1"].(float64); !_ok_ { err = errors.New("lv1 error"); return }; _v.Lv1 = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star1"].(float64); !_ok_ { err = errors.New("star1 error"); return }; _v.Star1 = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["equip1"].([]interface{}); !_ok_ { err = errors.New("equip1 error"); return }

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

    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["hero2"].(float64); !_ok_ { err = errors.New("hero2 error"); return }; _v.Hero2 = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lv2"].(float64); !_ok_ { err = errors.New("lv2 error"); return }; _v.Lv2 = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star2"].(float64); !_ok_ { err = errors.New("star2 error"); return }; _v.Star2 = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["equip2"].([]interface{}); !_ok_ { err = errors.New("equip2 error"); return }

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

    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["hero3"].(float64); !_ok_ { err = errors.New("hero3 error"); return }; _v.Hero3 = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lv3"].(float64); !_ok_ { err = errors.New("lv3 error"); return }; _v.Lv3 = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star3"].(float64); !_ok_ { err = errors.New("star3 error"); return }; _v.Star3 = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["equip3"].([]interface{}); !_ok_ { err = errors.New("equip3 error"); return }

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

    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["hero4"].(float64); !_ok_ { err = errors.New("hero4 error"); return }; _v.Hero4 = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lv4"].(float64); !_ok_ { err = errors.New("lv4 error"); return }; _v.Lv4 = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star4"].(float64); !_ok_ { err = errors.New("star4 error"); return }; _v.Star4 = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["equip4"].([]interface{}); !_ok_ { err = errors.New("equip4 error"); return }

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

    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["hero5"].(float64); !_ok_ { err = errors.New("hero5 error"); return }; _v.Hero5 = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lv5"].(float64); !_ok_ { err = errors.New("lv5 error"); return }; _v.Lv5 = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star5"].(float64); !_ok_ { err = errors.New("star5 error"); return }; _v.Star5 = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["equip5"].([]interface{}); !_ok_ { err = errors.New("equip5 error"); return }

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

    return
}

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