//------------------------------------------------------------------------------
// <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 GameNewSmithyData struct {
    Id int32
    Type int32
    Type2Png string
    Type2Star int32
    Type3Name string
    DrawingName string
    QualityText string
    DrawingPng string
    BasicDrop int32
    BasicCos []*Gameatn
    TemperatureCos int32
    RefineCos *Gameatn
    CustomizedCos1 *Gameatn
    CustomizedCos2 *Gameatn
    CustomizedLv []int32
    CustomizedLvDistribution []int32
    LightVelocity int32
}

const TypeId_GameNewSmithyData = -1249020316

func (*GameNewSmithyData) GetTypeId() int32 {
    return -1249020316
}

func (_v *GameNewSmithyData)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["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) }
    { var _ok_ bool; if _v.Type2Png, _ok_ = _buf["type2_png"].(string); !_ok_ { err = errors.New("type2_png error"); return } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type2_star"].(float64); !_ok_ { err = errors.New("type2_star error"); return }; _v.Type2Star = int32(_tempNum_) }
    {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["type3_name"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Type3Name error"); return };  { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Type3Name, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
    {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["drawing_name"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.DrawingName error"); return };  { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.DrawingName, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
    {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["quality_text"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.QualityText error"); return };  { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.QualityText, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
    { var _ok_ bool; if _v.DrawingPng, _ok_ = _buf["drawing_png"].(string); !_ok_ { err = errors.New("drawing_png error"); return } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["basic_drop"].(float64); !_ok_ { err = errors.New("basic_drop error"); return }; _v.BasicDrop = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["basic_cos"].([]interface{}); !_ok_ { err = errors.New("basic_cos error"); return }

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

    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["temperature_cos"].(float64); !_ok_ { err = errors.New("temperature_cos error"); return }; _v.TemperatureCos = int32(_tempNum_) }
    { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["refine_cos"].(map[string]interface{}); !_ok_ { err = errors.New("refine_cos error"); return }; if _v.RefineCos, err = DeserializeGameatn(_x_); err != nil { return } }
    { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["customized_cos1"].(map[string]interface{}); !_ok_ { err = errors.New("customized_cos1 error"); return }; if _v.CustomizedCos1, err = DeserializeGameatn(_x_); err != nil { return } }
    { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["customized_cos2"].(map[string]interface{}); !_ok_ { err = errors.New("customized_cos2 error"); return }; if _v.CustomizedCos2, err = DeserializeGameatn(_x_); err != nil { return } }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["customized_lv"].([]interface{}); !_ok_ { err = errors.New("customized_lv error"); return }

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

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

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

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

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