//------------------------------------------------------------------------------
// <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 GameSkillAtkData struct {
    Id int32
    Level int32
    MaxLV int32
    UnavailablePlayTypes []int32
    Name string
    Ico string
    CorrectPos int32
    IsMelee int32
    Act string
    Type int32
    CD int32
    Where []string
    Target int32
    ChildSkill *GameChildSkills
    Desc string
    Buffid []int32
    Map string
}

const TypeId_GameSkillAtkData = -1737392307

func (*GameSkillAtkData) GetTypeId() int32 {
    return -1737392307
}

func (_v *GameSkillAtkData)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["level"].(float64); !_ok_ { err = errors.New("level error"); return }; _v.Level = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["MaxLV"].(float64); !_ok_ { err = errors.New("MaxLV error"); return }; _v.MaxLV = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["UnavailablePlayTypes"].([]interface{}); !_ok_ { err = errors.New("UnavailablePlayTypes error"); return }

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

    {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.Ico, _ok_ = _buf["ico"].(string); !_ok_ { err = errors.New("ico error"); return } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["CorrectPos"].(float64); !_ok_ { err = errors.New("CorrectPos error"); return }; _v.CorrectPos = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["IsMelee"].(float64); !_ok_ { err = errors.New("IsMelee error"); return }; _v.IsMelee = int32(_tempNum_) }
    { var _ok_ bool; if _v.Act, _ok_ = _buf["act"].(string); !_ok_ { err = errors.New("act 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 _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["CD"].(float64); !_ok_ { err = errors.New("CD error"); return }; _v.CD = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["Where"].([]interface{}); !_ok_ { err = errors.New("Where error"); return }

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

    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Target"].(float64); !_ok_ { err = errors.New("Target error"); return }; _v.Target = int32(_tempNum_) }
    { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["ChildSkill"].(map[string]interface{}); !_ok_ { err = errors.New("ChildSkill error"); return }; if _v.ChildSkill, err = DeserializeGameChildSkills(_x_); err != nil { return } }
    {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["Desc"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Desc error"); return };  { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Desc, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["buffid"].([]interface{}); !_ok_ { err = errors.New("buffid error"); return }

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

    { var _ok_ bool; if _v.Map, _ok_ = _buf["map"].(string); !_ok_ { err = errors.New("map error"); return } }
    return
}

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