//------------------------------------------------------------------------------
// <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 GameMonsterFormatData struct {
    Id int32
    Pos int32
    CaptainId int32
    IsBoss int32
    BossHpCnt int32
    Heroid int32
    Star int32
    Equip []int32
    Newskill []int32
    Lv int32
    Hppro float32
    Atkpro float32
    Defpro float32
    Skill1 int32
    Skill2 int32
    Skill3 int32
    Speed int32
    Modelsize float32
}

const TypeId_GameMonsterFormatData = 1141351615

func (*GameMonsterFormatData) GetTypeId() int32 {
    return 1141351615
}

func (_v *GameMonsterFormatData)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 _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["captainId"].(float64); !_ok_ { err = errors.New("captainId error"); return }; _v.CaptainId = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["IsBoss"].(float64); !_ok_ { err = errors.New("IsBoss error"); return }; _v.IsBoss = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["bossHpCnt"].(float64); !_ok_ { err = errors.New("bossHpCnt error"); return }; _v.BossHpCnt = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["heroid"].(float64); !_ok_ { err = errors.New("heroid error"); return }; _v.Heroid = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star"].(float64); !_ok_ { err = errors.New("star error"); return }; _v.Star = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["equip"].([]interface{}); !_ok_ { err = errors.New("equip error"); return }

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

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

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

    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lv"].(float64); !_ok_ { err = errors.New("lv error"); return }; _v.Lv = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["hppro"].(float64); !_ok_ { err = errors.New("hppro error"); return }; _v.Hppro = float32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["atkpro"].(float64); !_ok_ { err = errors.New("atkpro error"); return }; _v.Atkpro = float32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["defpro"].(float64); !_ok_ { err = errors.New("defpro error"); return }; _v.Defpro = float32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["skill1"].(float64); !_ok_ { err = errors.New("skill1 error"); return }; _v.Skill1 = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["skill2"].(float64); !_ok_ { err = errors.New("skill2 error"); return }; _v.Skill2 = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["skill3"].(float64); !_ok_ { err = errors.New("skill3 error"); return }; _v.Skill3 = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["speed"].(float64); !_ok_ { err = errors.New("speed error"); return }; _v.Speed = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["modelsize"].(float64); !_ok_ { err = errors.New("modelsize error"); return }; _v.Modelsize = float32(_tempNum_) }
    return
}

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