
//------------------------------------------------------------------------------
// <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>
//------------------------------------------------------------------------------

#pragma once
#include <functional>
#include <algorithm>

#include "PhotonCRPG/Luban/CfgBean.h"

namespace cfg {

namespace Character { 
    /// <summary>
    /// 角色阵营
    /// </summary>
    enum class Faction
    {
        /// <summary>
        /// 玩家
        /// </summary>
        Player = 0,
        /// <summary>
        /// 敌人
        /// </summary>
        Enemy = 1,
        /// <summary>
        /// NPC
        /// </summary>
        NPC = 2,
    };

} 


namespace Item { 
    /// <summary>
    /// 护甲类型
    /// </summary>
    enum class ArmorType
    {
        /// <summary>
        /// 头盔
        /// </summary>
        Helmet = 0,
        /// <summary>
        /// 胸甲
        /// </summary>
        Chest = 1,
        /// <summary>
        /// 腰带
        /// </summary>
        Belt = 2,
        /// <summary>
        /// 腿甲
        /// </summary>
        Leg = 3,
        /// <summary>
        /// 鞋
        /// </summary>
        Shoe = 4,
        /// <summary>
        /// 饰品
        /// </summary>
        Trinket = 5,
    };

} 


namespace Item { 
    /// <summary>
    /// 物品品质
    /// </summary>
    enum class ItemQuality
    {
        /// <summary>
        /// 劣质
        /// </summary>
        Poor = 0,
        /// <summary>
        /// 普通
        /// </summary>
        Common = 1,
        /// <summary>
        /// 优良
        /// </summary>
        Good = 2,
        /// <summary>
        /// 史诗
        /// </summary>
        Epic = 3,
        /// <summary>
        /// 传说
        /// </summary>
        Legendary = 4,
    };

} 


namespace Item { 
    /// <summary>
    /// 物品类型
    /// </summary>
    enum class ItemType
    {
        /// <summary>
        /// 消耗品
        /// </summary>
        Consumable = 1,
        /// <summary>
        /// 武器
        /// </summary>
        Weapon = 2,
        /// <summary>
        /// 护甲
        /// </summary>
        Armor = 3,
        /// <summary>
        /// 道具
        /// </summary>
        Prop = 4,
        /// <summary>
        /// 收集品
        /// </summary>
        Collectable = 5,
        /// <summary>
        /// 任务物品
        /// </summary>
        Quest = 6,
        /// <summary>
        /// 杂物
        /// </summary>
        Mundane = 7,
    };

} 


namespace Item { 
    /// <summary>
    /// 武器攻击类型
    /// </summary>
    enum class WeaponAtkType
    {
        /// <summary>
        /// 远程
        /// </summary>
        Ranged = 0,
        /// <summary>
        /// 近战
        /// </summary>
        Close = 1,
        /// <summary>
        /// 副手
        /// </summary>
        SHand = 2,
    };

} 


namespace Item { 
    /// <summary>
    /// 武器类型
    /// </summary>
    enum class WeaponType
    {
        /// <summary>
        /// 手枪
        /// </summary>
        Pistol = 0,
        /// <summary>
        /// 步枪
        /// </summary>
        Rifle = 1,
        /// <summary>
        /// 狙击枪
        /// </summary>
        SniperRifle = 2,
        /// <summary>
        /// 剑
        /// </summary>
        Sword = 3,
    };

} 


namespace Attr { struct Basic; }
namespace Attr { struct Battle; }
namespace Attr { struct Core; }
namespace Character { struct CharacterTable; }
namespace Item { struct ArmorTable; }
namespace Item { struct ItemData; }
namespace Item { struct ItemTable; }
namespace Item { struct WeaponTable; }
namespace Uni { struct BasicInfo; }
namespace Uni { struct LocalizationTable; }
 struct vector2; 
 struct vector3; 
 struct vector4; 

namespace Attr {

struct Basic : public luban::CfgBean 
{
    static bool deserializeBasic(::luban::ByteBuf& _buf, ::luban::SharedPtr<Basic>& _out);

    virtual ~Basic() {}

    bool deserialize(::luban::ByteBuf& _buf);

    /**
     * 血量
     */
    ::luban::float32 hp;
    /**
     * 护甲
     */
    ::luban::float32 arp;
    /**
     * 行动点
     */
    ::luban::float32 ap;
    /**
     * 移动点
     */
    ::luban::float32 mp;

    static constexpr int __ID__ = 679841265;

    int getTypeId() const override { return __ID__; }
};

}

namespace Attr {

struct Battle : public luban::CfgBean 
{
    static bool deserializeBattle(::luban::ByteBuf& _buf, ::luban::SharedPtr<Battle>& _out);

    virtual ~Battle() {}

    bool deserialize(::luban::ByteBuf& _buf);

    /**
     * 攻击力
     */
    ::luban::float32 attack;
    /**
     * 防御力
     */
    ::luban::float32 defence;
    /**
     * 速度
     */
    ::luban::float32 speed;
    /**
     * 暴击率
     */
    ::luban::float32 critical;
    /**
     * 命中率
     */
    ::luban::float32 hit;
    /**
     * 闪避率
     */
    ::luban::float32 dodge;

    static constexpr int __ID__ = -399716523;

    int getTypeId() const override { return __ID__; }
};

}

namespace Attr {

struct Core : public luban::CfgBean 
{
    static bool deserializeCore(::luban::ByteBuf& _buf, ::luban::SharedPtr<Core>& _out);

    virtual ~Core() {}

    bool deserialize(::luban::ByteBuf& _buf);

    /**
     * 力量
     */
    ::luban::float32 strength;
    /**
     * 敏捷
     */
    ::luban::float32 agility;
    /**
     * 坚韧
     */
    ::luban::float32 toughness;
    /**
     * 感知
     */
    ::luban::float32 perception;
    /**
     * 意志
     */
    ::luban::float32 willpower;
    /**
     * 智力
     */
    ::luban::float32 intelligence;
    /**
     * 社交
     */
    ::luban::float32 fellowship;

    static constexpr int __ID__ = 1961636220;

    int getTypeId() const override { return __ID__; }
};

}

namespace Character {

struct CharacterTable : public luban::CfgBean 
{
    static bool deserializeCharacterTable(::luban::ByteBuf& _buf, ::luban::SharedPtr<CharacterTable>& _out);

    virtual ~CharacterTable() {}

    bool deserialize(::luban::ByteBuf& _buf);

    /**
     * id
     */
    ::luban::String id;
    /**
     * 名称
     */
    ::luban::SharedPtr<Uni::BasicInfo> basicInfo;
    /**
     * 年龄
     */
    ::luban::int32 age;
    /**
     * 背景故事
     */
    ::luban::String story;
    /**
     * 阵营
     */
    Character::Faction faction;
    /**
     * 血量
     */
    ::luban::SharedPtr<Attr::Basic> initAttrBasic;
    /**
     * 力量
     */
    ::luban::SharedPtr<Attr::Core> initAttrCore;
    /**
     * 攻击力
     */
    ::luban::SharedPtr<Attr::Battle> initAttrBattle;
    /**
     * 初始装备列表
     */
    ::luban::Array<::luban::int32> initGearList;

    static constexpr int __ID__ = 1358600138;

    int getTypeId() const override { return __ID__; }
};

}

namespace Item {

struct ArmorTable : public luban::CfgBean 
{
    static bool deserializeArmorTable(::luban::ByteBuf& _buf, ::luban::SharedPtr<ArmorTable>& _out);

    virtual ~ArmorTable() {}

    bool deserialize(::luban::ByteBuf& _buf);

    /**
     * ID
     */
    ::luban::int32 id;
    /**
     * 护甲类型
     */
    Item::ArmorType type;
    /**
     * 物品等级
     */
    ::luban::int32 level;
    /**
     * 穿戴等级
     */
    ::luban::int32 levelR;
    /**
     * 血量
     */
    ::luban::SharedPtr<Attr::Basic> attrBasic;
    /**
     * 提供核心属性
     */
    ::luban::SharedPtr<Attr::Core> attrCore;
    /**
     * 穿戴所需核心属性
     */
    ::luban::SharedPtr<Attr::Core> attrCoreR;
    /**
     * 攻击力
     */
    ::luban::SharedPtr<Attr::Battle> attrBattle;

    static constexpr int __ID__ = 413562762;

    int getTypeId() const override { return __ID__; }
};

}

namespace Item {

struct ItemData : public luban::CfgBean 
{
    static bool deserializeItemData(::luban::ByteBuf& _buf, ::luban::SharedPtr<ItemData>& _out);

    virtual ~ItemData() {}

    bool deserialize(::luban::ByteBuf& _buf);

    /**
     * 类型
     */
    Item::ItemType type;
    /**
     * 品质
     */
    Item::ItemQuality quality;
    /**
     * 重量
     */
    ::luban::float32 weight;
    /**
     * 买入价
     */
    ::luban::float32 buy;
    /**
     * 卖出价
     */
    ::luban::float32 sell;
    /**
     * 是否堆叠
     */
    bool stackable;
    /**
     * 最大堆叠数
     */
    ::luban::int32 maxStack;

    static constexpr int __ID__ = 799665624;

    int getTypeId() const override { return __ID__; }
};

}

namespace Item {

struct ItemTable : public luban::CfgBean 
{
    static bool deserializeItemTable(::luban::ByteBuf& _buf, ::luban::SharedPtr<ItemTable>& _out);

    virtual ~ItemTable() {}

    bool deserialize(::luban::ByteBuf& _buf);

    /**
     * id
     */
    ::luban::int32 id;
    /**
     * 名称
     */
    ::luban::SharedPtr<Uni::BasicInfo> basicInfo;
    /**
     * 类型
     */
    ::luban::SharedPtr<Item::ItemData> itemData;

    static constexpr int __ID__ = -965409952;

    int getTypeId() const override { return __ID__; }
};

}

namespace Item {

struct WeaponTable : public luban::CfgBean 
{
    static bool deserializeWeaponTable(::luban::ByteBuf& _buf, ::luban::SharedPtr<WeaponTable>& _out);

    virtual ~WeaponTable() {}

    bool deserialize(::luban::ByteBuf& _buf);

    /**
     * ID
     */
    ::luban::int32 id;
    /**
     * 武器类型
     */
    Item::WeaponType type;
    /**
     * 攻击类型
     */
    Item::WeaponAtkType atkType;
    /**
     * 是否双手
     */
    bool TwoHand;
    /**
     * 物品等级
     */
    ::luban::int32 level;
    /**
     * 穿戴所需等级
     */
    ::luban::int32 levelR;
    /**
     * 模型路径
     */
    ::luban::String model;
    /**
     * 插槽名称
     */
    ::luban::String socket;
    /**
     * 待机动画标签
     */
    ::luban::String idleAnimTag;
    /**
     * 血量
     */
    ::luban::SharedPtr<Attr::Basic> attrBasic;
    /**
     * 提供特性
     */
    ::luban::SharedPtr<Attr::Core> attrCore;
    /**
     * 穿戴所需特性
     */
    ::luban::SharedPtr<Attr::Core> attrCoreR;
    /**
     * 攻击力
     */
    ::luban::SharedPtr<Attr::Battle> attrBattle;
    /**
     * 基础伤害
     */
    ::luban::float32 baseDamage;
    /**
     * 攻击范围
     */
    ::luban::int32 range;
    /**
     * 弹匣弹药
     */
    ::luban::SharedPtr<::luban::int32> clipAmmo;
    /**
     * 最大弹药
     */
    ::luban::SharedPtr<::luban::int32> maxAmmo;
    /**
     * 射出弹药
     */
    ::luban::SharedPtr<::luban::int32> shotAmmo;
    /**
     * 射速
     */
    ::luban::SharedPtr<::luban::float32> fireRate;

    static constexpr int __ID__ = 1639224503;

    int getTypeId() const override { return __ID__; }
};

}

namespace Uni {

struct BasicInfo : public luban::CfgBean 
{
    static bool deserializeBasicInfo(::luban::ByteBuf& _buf, ::luban::SharedPtr<BasicInfo>& _out);

    virtual ~BasicInfo() {}

    bool deserialize(::luban::ByteBuf& _buf);

    /**
     * 名称
     */
    ::luban::String name;
    /**
     * 描述
     */
    ::luban::String desc;
    /**
     * 图标
     */
    ::luban::String icon;

    static constexpr int __ID__ = -1996758466;

    int getTypeId() const override { return __ID__; }
};

}

namespace Uni {

struct LocalizationTable : public luban::CfgBean 
{
    static bool deserializeLocalizationTable(::luban::ByteBuf& _buf, ::luban::SharedPtr<LocalizationTable>& _out);

    virtual ~LocalizationTable() {}

    bool deserialize(::luban::ByteBuf& _buf);

    /**
     * ID
     */
    ::luban::String id;
    /**
     * 中文
     */
    ::luban::String cn;
    /**
     * 英文
     */
    ::luban::String en;

    static constexpr int __ID__ = 1067800311;

    int getTypeId() const override { return __ID__; }
};

}



struct vector2 : public luban::CfgBean 
{
    static bool deserializevector2(::luban::ByteBuf& _buf, ::luban::SharedPtr<vector2>& _out);

    virtual ~vector2() {}

    bool deserialize(::luban::ByteBuf& _buf);

    ::luban::float32 x;
    ::luban::float32 y;

    static constexpr int __ID__ = 337790799;

    int getTypeId() const override { return __ID__; }
};





struct vector3 : public luban::CfgBean 
{
    static bool deserializevector3(::luban::ByteBuf& _buf, ::luban::SharedPtr<vector3>& _out);

    virtual ~vector3() {}

    bool deserialize(::luban::ByteBuf& _buf);

    ::luban::float32 x;
    ::luban::float32 y;
    ::luban::float32 z;

    static constexpr int __ID__ = 337790800;

    int getTypeId() const override { return __ID__; }
};





struct vector4 : public luban::CfgBean 
{
    static bool deserializevector4(::luban::ByteBuf& _buf, ::luban::SharedPtr<vector4>& _out);

    virtual ~vector4() {}

    bool deserialize(::luban::ByteBuf& _buf);

    ::luban::float32 x;
    ::luban::float32 y;
    ::luban::float32 z;
    ::luban::float32 w;

    static constexpr int __ID__ = 337790801;

    int getTypeId() const override { return __ID__; }
};



namespace Item {


class TbItem
{
    private:
    ::luban::HashMap<::luban::int32, ::luban::SharedPtr<Item::ItemTable>> _dataMap;
    ::luban::Vector<::luban::SharedPtr<Item::ItemTable>> _dataList;
    
    public:
    bool load(::luban::ByteBuf& _buf)
    {        
        int n;
        if (!_buf.readSize(n)) return false;
        for(; n > 0 ; --n)
        {
            ::luban::SharedPtr<Item::ItemTable> _v;
            if(!Item::ItemTable::deserializeItemTable(_buf, _v)) return false;
            _dataList.push_back(_v);
            _dataMap[_v->id] = _v;
        }
        return true;
    }

    const ::luban::HashMap<::luban::int32, ::luban::SharedPtr<Item::ItemTable>>& getDataMap() const { return _dataMap; }
    const ::luban::Vector<::luban::SharedPtr<Item::ItemTable>>& getDataList() const { return _dataList; }

    Item::ItemTable* getRaw(::luban::int32 key)
    { 
        auto it = _dataMap.find(key);
        return it != _dataMap.end() ? it->second.get() : nullptr;
    }

    ::luban::SharedPtr<Item::ItemTable> get(::luban::int32 key)
    { 
        auto it = _dataMap.find(key);
        return it != _dataMap.end() ? it->second : nullptr;
    }

};

}

namespace Item {


class TbWeapon
{
    private:
    ::luban::HashMap<::luban::int32, ::luban::SharedPtr<Item::WeaponTable>> _dataMap;
    ::luban::Vector<::luban::SharedPtr<Item::WeaponTable>> _dataList;
    
    public:
    bool load(::luban::ByteBuf& _buf)
    {        
        int n;
        if (!_buf.readSize(n)) return false;
        for(; n > 0 ; --n)
        {
            ::luban::SharedPtr<Item::WeaponTable> _v;
            if(!Item::WeaponTable::deserializeWeaponTable(_buf, _v)) return false;
            _dataList.push_back(_v);
            _dataMap[_v->id] = _v;
        }
        return true;
    }

    const ::luban::HashMap<::luban::int32, ::luban::SharedPtr<Item::WeaponTable>>& getDataMap() const { return _dataMap; }
    const ::luban::Vector<::luban::SharedPtr<Item::WeaponTable>>& getDataList() const { return _dataList; }

    Item::WeaponTable* getRaw(::luban::int32 key)
    { 
        auto it = _dataMap.find(key);
        return it != _dataMap.end() ? it->second.get() : nullptr;
    }

    ::luban::SharedPtr<Item::WeaponTable> get(::luban::int32 key)
    { 
        auto it = _dataMap.find(key);
        return it != _dataMap.end() ? it->second : nullptr;
    }

};

}

namespace Item {


class TbArmor
{
    private:
    ::luban::HashMap<::luban::int32, ::luban::SharedPtr<Item::ArmorTable>> _dataMap;
    ::luban::Vector<::luban::SharedPtr<Item::ArmorTable>> _dataList;
    
    public:
    bool load(::luban::ByteBuf& _buf)
    {        
        int n;
        if (!_buf.readSize(n)) return false;
        for(; n > 0 ; --n)
        {
            ::luban::SharedPtr<Item::ArmorTable> _v;
            if(!Item::ArmorTable::deserializeArmorTable(_buf, _v)) return false;
            _dataList.push_back(_v);
            _dataMap[_v->id] = _v;
        }
        return true;
    }

    const ::luban::HashMap<::luban::int32, ::luban::SharedPtr<Item::ArmorTable>>& getDataMap() const { return _dataMap; }
    const ::luban::Vector<::luban::SharedPtr<Item::ArmorTable>>& getDataList() const { return _dataList; }

    Item::ArmorTable* getRaw(::luban::int32 key)
    { 
        auto it = _dataMap.find(key);
        return it != _dataMap.end() ? it->second.get() : nullptr;
    }

    ::luban::SharedPtr<Item::ArmorTable> get(::luban::int32 key)
    { 
        auto it = _dataMap.find(key);
        return it != _dataMap.end() ? it->second : nullptr;
    }

};

}

namespace Character {


class TbCharacter
{
    private:
    ::luban::HashMap<::luban::String, ::luban::SharedPtr<Character::CharacterTable>> _dataMap;
    ::luban::Vector<::luban::SharedPtr<Character::CharacterTable>> _dataList;
    
    public:
    bool load(::luban::ByteBuf& _buf)
    {        
        int n;
        if (!_buf.readSize(n)) return false;
        for(; n > 0 ; --n)
        {
            ::luban::SharedPtr<Character::CharacterTable> _v;
            if(!Character::CharacterTable::deserializeCharacterTable(_buf, _v)) return false;
            _dataList.push_back(_v);
            _dataMap[_v->id] = _v;
        }
        return true;
    }

    const ::luban::HashMap<::luban::String, ::luban::SharedPtr<Character::CharacterTable>>& getDataMap() const { return _dataMap; }
    const ::luban::Vector<::luban::SharedPtr<Character::CharacterTable>>& getDataList() const { return _dataList; }

    Character::CharacterTable* getRaw(::luban::String key)
    { 
        auto it = _dataMap.find(key);
        return it != _dataMap.end() ? it->second.get() : nullptr;
    }

    ::luban::SharedPtr<Character::CharacterTable> get(::luban::String key)
    { 
        auto it = _dataMap.find(key);
        return it != _dataMap.end() ? it->second : nullptr;
    }

};

}

namespace Uni {


class TbLocalization
{
    private:
    ::luban::HashMap<::luban::String, ::luban::SharedPtr<Uni::LocalizationTable>> _dataMap;
    ::luban::Vector<::luban::SharedPtr<Uni::LocalizationTable>> _dataList;
    
    public:
    bool load(::luban::ByteBuf& _buf)
    {        
        int n;
        if (!_buf.readSize(n)) return false;
        for(; n > 0 ; --n)
        {
            ::luban::SharedPtr<Uni::LocalizationTable> _v;
            if(!Uni::LocalizationTable::deserializeLocalizationTable(_buf, _v)) return false;
            _dataList.push_back(_v);
            _dataMap[_v->id] = _v;
        }
        return true;
    }

    const ::luban::HashMap<::luban::String, ::luban::SharedPtr<Uni::LocalizationTable>>& getDataMap() const { return _dataMap; }
    const ::luban::Vector<::luban::SharedPtr<Uni::LocalizationTable>>& getDataList() const { return _dataList; }

    Uni::LocalizationTable* getRaw(::luban::String key)
    { 
        auto it = _dataMap.find(key);
        return it != _dataMap.end() ? it->second.get() : nullptr;
    }

    ::luban::SharedPtr<Uni::LocalizationTable> get(::luban::String key)
    { 
        auto it = _dataMap.find(key);
        return it != _dataMap.end() ? it->second : nullptr;
    }

};

}

class Tables
{
    public:
     Item::TbItem TbItem;
     Item::TbWeapon TbWeapon;
     Item::TbArmor TbArmor;
     Character::TbCharacter TbCharacter;
     Uni::TbLocalization TbLocalization;

    bool load(::luban::Loader<::luban::ByteBuf> loader)
    {
        ::luban::ByteBuf buf;
        buf.clear();
        if (!loader(buf, "item_tbitem")) return false;
        if (!TbItem.load(buf)) return false;
        buf.clear();
        if (!loader(buf, "item_tbweapon")) return false;
        if (!TbWeapon.load(buf)) return false;
        buf.clear();
        if (!loader(buf, "item_tbarmor")) return false;
        if (!TbArmor.load(buf)) return false;
        buf.clear();
        if (!loader(buf, "character_tbcharacter")) return false;
        if (!TbCharacter.load(buf)) return false;
        buf.clear();
        if (!loader(buf, "uni_tblocalization")) return false;
        if (!TbLocalization.load(buf)) return false;
        return true;
    }
};



}

