//------------------------------------------------------------------------------
// <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 GameSkillPassiveData struct {
    Id int32
    When int32
    FromCheck string
    TargetCheck string
    MainSkillCheck string
    AfterSkillCheck string
    BuffCheck string
    AddCon []string
    PasPr int32
    Type string
    MaxEmitTimes int32
    Callback []int32
}

const TypeId_GameSkillPassiveData = -247912740

func (*GameSkillPassiveData) GetTypeId() int32 {
    return -247912740
}

func (_v *GameSkillPassiveData)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["When"].(float64); !_ok_ { err = errors.New("When error"); return }; _v.When = int32(_tempNum_) }
    { var _ok_ bool; if _v.FromCheck, _ok_ = _buf["FromCheck"].(string); !_ok_ { err = errors.New("FromCheck error"); return } }
    { var _ok_ bool; if _v.TargetCheck, _ok_ = _buf["TargetCheck"].(string); !_ok_ { err = errors.New("TargetCheck error"); return } }
    { var _ok_ bool; if _v.MainSkillCheck, _ok_ = _buf["MainSkillCheck"].(string); !_ok_ { err = errors.New("MainSkillCheck error"); return } }
    { var _ok_ bool; if _v.AfterSkillCheck, _ok_ = _buf["AfterSkillCheck"].(string); !_ok_ { err = errors.New("AfterSkillCheck error"); return } }
    { var _ok_ bool; if _v.BuffCheck, _ok_ = _buf["BuffCheck"].(string); !_ok_ { err = errors.New("BuffCheck error"); return } }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["AddCon"].([]interface{}); !_ok_ { err = errors.New("AddCon error"); return }

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

    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["PasPr"].(float64); !_ok_ { err = errors.New("PasPr error"); return }; _v.PasPr = int32(_tempNum_) }
    { var _ok_ bool; if _v.Type, _ok_ = _buf["Type"].(string); !_ok_ { err = errors.New("Type error"); return } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["MaxEmitTimes"].(float64); !_ok_ { err = errors.New("MaxEmitTimes error"); return }; _v.MaxEmitTimes = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["Callback"].([]interface{}); !_ok_ { err = errors.New("Callback error"); return }

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

    return
}

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