#ifndef ESS_RESOURCE_DB_H #define ESS_RESOURCE_DB_H /*************************************************************************/ /* ess_resource_db.h */ /*************************************************************************/ /* This file is part of: */ /* PANDEMONIUM ENGINE */ /* https://github.com/Relintai/pandemonium_engine */ /*************************************************************************/ /* Copyright (c) 2022-present Péter Magyar. */ /* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ /* */ /* 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. */ /*************************************************************************/ #include "core/bind/core_bind.h" #include "core/containers/hash_map.h" #include "core/containers/vector.h" #include "core/object/resource.h" #include "core/string/ustring.h" #include "core/variant/variant.h" #include "../item_enums.h" class Spell; class EntityData; class CraftRecipe; class ItemTemplate; class EntityResource; class EntitySkillData; class EntityCreateInfo; class SpellCastInfo; class EntitySpeciesData; class ESSResourceDB : public Resource { GDCLASS(ESSResourceDB, Resource); public: Ref get_skill_for_armor_type(const int index); void set_skill_for_armor_type(const int index, const Ref &aura); virtual Ref get_entity_resource(int class_id) = 0; virtual Ref get_entity_resource_index(int index) = 0; virtual int get_entity_resource_count() = 0; virtual void add_entity_resource(Ref cls); virtual Vector get_entity_resources() const = 0; virtual void set_entity_resources(const Vector &data) = 0; Ref get_entity_resource_path(const StringName &path); StringName entity_resource_id_to_path(const int id) const; int entity_resource_path_to_id(const StringName &path) const; virtual Ref get_entity_skill(int class_id) = 0; virtual Ref get_entity_skill_index(int index) = 0; virtual int get_entity_skill_count() = 0; virtual void add_entity_skill(Ref cls); virtual Vector get_entity_skills() const = 0; virtual void set_entity_skills(const Vector &data) = 0; Ref get_entity_skill_path(const StringName &path); StringName entity_skill_id_to_path(const int id) const; int entity_skill_path_to_id(const StringName &path) const; virtual Ref get_entity_data(int class_id) = 0; virtual Ref get_entity_data_index(int index) = 0; virtual int get_entity_data_count() = 0; virtual void add_entity_data(Ref cls); virtual Vector get_entity_datas() const = 0; virtual void set_entity_datas(const Vector &data) = 0; Ref get_entity_data_path(const StringName &path); StringName entity_data_id_to_path(const int id) const; int entity_data_path_to_id(const StringName &path) const; virtual Ref get_spell(int spell_id) = 0; virtual Ref get_spell_index(int index) = 0; virtual int get_spell_count() = 0; virtual void add_spell(Ref spell); virtual Vector get_spells() const = 0; virtual void set_spells(const Vector &data) = 0; Ref get_spell_path(const StringName &path); StringName spell_id_to_path(const int id) const; int spell_path_to_id(const StringName &path) const; virtual Ref get_craft_recipe(int craft_id) = 0; virtual Ref get_craft_recipe_index(int index) = 0; virtual int get_craft_recipe_count() = 0; virtual void add_craft_recipe(Ref aura); virtual Vector get_craft_recipes() const = 0; virtual void set_craft_recipes(const Vector &data) = 0; Ref get_craft_recipe_path(const StringName &path); StringName craft_recipe_id_to_path(const int id) const; int craft_recipe_path_to_id(const StringName &path) const; virtual void add_item_template(Ref aura); virtual Ref get_item_template(int item_id) = 0; virtual Ref get_item_template_index(int index) = 0; virtual int get_item_template_count() = 0; virtual Vector get_item_templates() const = 0; virtual void set_item_templates(const Vector &data) = 0; Ref get_item_template_path(const StringName &path); StringName item_template_id_to_path(const int id) const; int item_template_path_to_id(const StringName &path) const; virtual void add_entity_species_data(Ref aura); virtual Ref get_entity_species_data(int item_id) = 0; virtual Ref get_entity_species_data_index(int index) = 0; virtual int get_entity_species_data_count() = 0; virtual Vector get_entity_species_datas() const = 0; virtual void set_entity_species_datas(const Vector &data) = 0; Ref get_entity_species_data_path(const StringName &path); StringName entity_species_id_to_path(const int id) const; int entity_species_path_to_id(const StringName &path) const; virtual void clear(); void add_entity_resource_db(Ref other); void initialize(); ESSResourceDB(); ~ESSResourceDB(); protected: static void _bind_methods(); Ref _armor_type_skills[ItemEnums::ARMOR_TYPE_MAX]; HashMap _entity_resources_id_to_path; HashMap _entity_resources_path_to_id; HashMap _entity_skill_id_to_path; HashMap _entity_skill_path_to_id; HashMap _entity_data_id_to_path; HashMap _entity_data_path_to_id; HashMap _spell_id_to_path; HashMap _spell_path_to_id; HashMap _craft_recipe_id_to_path; HashMap _craft_recipe_path_to_id; HashMap _item_template_id_to_path; HashMap _item_template_path_to_id; HashMap _entity_species_id_to_path; HashMap _entity_species_path_to_id; }; #endif