/* Copyright (c) 2019-2022 Péter Magyar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ESS_RESOURCE_DB_MAP_H #define ESS_RESOURCE_DB_MAP_H #include "ess_resource_db.h" #include "core/version.h" #include "core/variant/variant.h" #include "core/templates/vector.h" #include "core/templates/hash_map.h" #include "core/string/ustring.h" #include "core/config/engine.h" #include "core/variant/array.h" #include "core/core_bind.h" #include "scene/main/node.h" #include "../item_enums.h" #include "../defines.h" class Spell; class EntityData; class CraftRecipe; class ItemTemplate; class EntityResource; class EntitySkillData; class EntityCreateInfo; class SpellCastInfo; class EntitySpeciesData; class ESSResourceDBMap : public ESSResourceDB { GDCLASS(ESSResourceDBMap, ESSResourceDB); public: Ref get_entity_resource(int class_id); Ref get_entity_resource_index(int index); int get_entity_resource_count(); void add_entity_resource(Ref cls); Vector get_entity_resources() const; void set_entity_resources(const Vector &data); Ref get_entity_skill(int class_id); Ref get_entity_skill_index(int index); int get_entity_skill_count(); void add_entity_skill(Ref cls); Vector get_entity_skills() const; void set_entity_skills(const Vector &data); Ref get_entity_data(int class_id); Ref get_entity_data_index(int index); int get_entity_data_count(); void add_entity_data(Ref cls); Vector get_entity_datas() const; void set_entity_datas(const Vector &data); Ref get_spell(int spell_id); Ref get_spell_index(int index); int get_spell_count(); void add_spell(Ref spell); Vector get_spells() const; void set_spells(const Vector &data); Ref get_craft_recipe(int craft_id); Ref get_craft_recipe_index(int index); int get_craft_recipe_count(); void add_craft_recipe(Ref aura); Vector get_craft_recipes() const; void set_craft_recipes(const Vector &data); void add_item_template(Ref aura); Ref get_item_template(int item_id); Ref get_item_template_index(int index); int get_item_template_count(); Vector get_item_templates() const; void set_item_templates(const Vector &data); void add_entity_species_data(Ref aura); Ref get_entity_species_data(int item_id); Ref get_entity_species_data_index(int index); int get_entity_species_data_count(); Vector get_entity_species_datas() const; void set_entity_species_datas(const Vector &data); ESSResourceDBMap(); ~ESSResourceDBMap(); protected: static void _bind_methods(); private: Vector > _entity_resources; HashMap > _entity_resource_map; Vector > _entity_skills; HashMap > _entity_skill_map; Vector > _entity_datas; HashMap > _entity_data_map; Vector > _spells; HashMap > _spell_map; Vector > _craft_recipes; HashMap > _craft_recipe_map; Vector > _item_templates; HashMap > _item_template_map; Vector > _entity_species_datas; HashMap > _entity_species_data_map; }; #endif