mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-02-22 17:18:12 +01:00
Added hashmaps to ESSResoruceDB to easilz convert between ids and resource paths.
This commit is contained in:
parent
67395b3d35
commit
246f8178eb
@ -48,6 +48,158 @@ void ESSResourceDB::set_xp_data(const Ref<XPData> &data) {
|
||||
_xp_data = data;
|
||||
}
|
||||
|
||||
void ESSResourceDB::add_entity_resource(Ref<EntityResourceData> cls) {
|
||||
if (!cls.is_valid())
|
||||
return;
|
||||
|
||||
_entity_resources_id_to_path.set(cls->get_id(), cls->get_path());
|
||||
_entity_resources_path_to_id.set(cls->get_path(), cls->get_id());
|
||||
}
|
||||
|
||||
void ESSResourceDB::add_entity_skill(Ref<EntitySkillData> cls) {
|
||||
if (!cls.is_valid())
|
||||
return;
|
||||
|
||||
_entity_skill_id_to_path.set(cls->get_id(), cls->get_path());
|
||||
_entity_skill_path_to_id.set(cls->get_path(), cls->get_id());
|
||||
}
|
||||
|
||||
void ESSResourceDB::add_entity_data(Ref<EntityData> cls) {
|
||||
if (!cls.is_valid())
|
||||
return;
|
||||
|
||||
_entity_data_id_to_path.set(cls->get_id(), cls->get_path());
|
||||
_entity_data_path_to_id.set(cls->get_path(), cls->get_id());
|
||||
}
|
||||
|
||||
void ESSResourceDB::add_spell(Ref<Spell> spell) {
|
||||
if (!spell.is_valid())
|
||||
return;
|
||||
|
||||
_spell_id_to_path.set(spell->get_id(), spell->get_path());
|
||||
_spell_path_to_id.set(spell->get_path(), spell->get_id());
|
||||
}
|
||||
|
||||
void ESSResourceDB::add_aura(Ref<Aura> aura) {
|
||||
if (!aura.is_valid())
|
||||
return;
|
||||
|
||||
_aura_id_to_path.set(aura->get_id(), aura->get_path());
|
||||
_aura_path_to_id.set(aura->get_path(), aura->get_id());
|
||||
}
|
||||
|
||||
void ESSResourceDB::add_craft_recipe(Ref<CraftRecipe> cda) {
|
||||
if (!cda.is_valid())
|
||||
return;
|
||||
|
||||
_craft_recipe_id_to_path.set(cda->get_id(), cda->get_path());
|
||||
_craft_recipe_path_to_id.set(cda->get_path(), cda->get_id());
|
||||
}
|
||||
|
||||
void ESSResourceDB::add_item_template(Ref<ItemTemplate> cda) {
|
||||
if (!cda.is_valid())
|
||||
return;
|
||||
|
||||
_item_template_id_to_path.set(cda->get_id(), cda->get_path());
|
||||
_item_template_path_to_id.set(cda->get_path(), cda->get_id());
|
||||
}
|
||||
|
||||
void ESSResourceDB::add_entity_species_data(Ref<EntitySpeciesData> cda) {
|
||||
if (!cda.is_valid())
|
||||
return;
|
||||
|
||||
_entity_species_id_to_path.set(cda->get_id(), cda->get_path());
|
||||
_entity_species_path_to_id.set(cda->get_path(), cda->get_id());
|
||||
}
|
||||
|
||||
StringName ESSResourceDB::entity_resource_id_to_path(const int id) const {
|
||||
ERR_FAIL_COND_V(!_entity_resources_id_to_path.has(id), StringName());
|
||||
|
||||
return _entity_resources_id_to_path[id];
|
||||
}
|
||||
int ESSResourceDB::entity_resource_path_to_id(const StringName &path) const {
|
||||
ERR_FAIL_COND_V(!_entity_resources_path_to_id.has(path), 0);
|
||||
|
||||
return _entity_resources_path_to_id[path];
|
||||
}
|
||||
|
||||
StringName ESSResourceDB::entity_skill_id_to_path(const int id) const {
|
||||
ERR_FAIL_COND_V(!_entity_skill_id_to_path.has(id), StringName());
|
||||
|
||||
return _entity_skill_id_to_path[id];
|
||||
}
|
||||
int ESSResourceDB::entity_skill_path_to_id(const StringName &path) const {
|
||||
ERR_FAIL_COND_V(!_entity_skill_path_to_id.has(path), 0);
|
||||
|
||||
return _entity_skill_path_to_id[path];
|
||||
}
|
||||
|
||||
StringName ESSResourceDB::entity_data_id_to_path(const int id) const {
|
||||
ERR_FAIL_COND_V(!_entity_data_id_to_path.has(id), StringName());
|
||||
|
||||
return _entity_data_id_to_path[id];
|
||||
}
|
||||
int ESSResourceDB::entity_data_path_to_id(const StringName &path) const {
|
||||
ERR_FAIL_COND_V(!_entity_data_path_to_id.has(path), 0);
|
||||
|
||||
return _entity_data_path_to_id[path];
|
||||
}
|
||||
|
||||
StringName ESSResourceDB::spell_id_to_path(const int id) const {
|
||||
ERR_FAIL_COND_V(!_spell_id_to_path.has(id), StringName());
|
||||
|
||||
return _spell_id_to_path[id];
|
||||
}
|
||||
int ESSResourceDB::spell_path_to_id(const StringName &path) const {
|
||||
ERR_FAIL_COND_V(!_spell_path_to_id.has(path), 0);
|
||||
|
||||
return _spell_path_to_id[path];
|
||||
}
|
||||
|
||||
StringName ESSResourceDB::aura_id_to_path(const int id) const {
|
||||
ERR_FAIL_COND_V(!_aura_id_to_path.has(id), StringName());
|
||||
|
||||
return _aura_id_to_path[id];
|
||||
}
|
||||
int ESSResourceDB::aura_path_to_id(const StringName &path) const {
|
||||
ERR_FAIL_COND_V(!_aura_path_to_id.has(path), 0);
|
||||
|
||||
return _aura_path_to_id[path];
|
||||
}
|
||||
|
||||
StringName ESSResourceDB::craft_recipe_id_to_path(const int id) const {
|
||||
ERR_FAIL_COND_V(!_craft_recipe_id_to_path.has(id), StringName());
|
||||
|
||||
return _craft_recipe_id_to_path[id];
|
||||
}
|
||||
int ESSResourceDB::craft_recipe_path_to_id(const StringName &path) const {
|
||||
ERR_FAIL_COND_V(!_craft_recipe_path_to_id.has(path), 0);
|
||||
|
||||
return _craft_recipe_path_to_id[path];
|
||||
}
|
||||
|
||||
StringName ESSResourceDB::item_template_id_to_path(const int id) const {
|
||||
ERR_FAIL_COND_V(!_item_template_id_to_path.has(id), StringName());
|
||||
|
||||
return _item_template_id_to_path[id];
|
||||
}
|
||||
int ESSResourceDB::item_template_path_to_id(const StringName &path) const {
|
||||
ERR_FAIL_COND_V(!_item_template_path_to_id.has(path), 0);
|
||||
|
||||
return _item_template_path_to_id[path];
|
||||
}
|
||||
|
||||
StringName ESSResourceDB::entity_species_id_to_path(const int id) const {
|
||||
ERR_FAIL_COND_V(!_entity_species_id_to_path.has(id), StringName());
|
||||
|
||||
return _entity_species_id_to_path[id];
|
||||
}
|
||||
int ESSResourceDB::entity_species_path_to_id(const StringName &path) const {
|
||||
ERR_FAIL_COND_V(!_entity_species_path_to_id.has(path), 0);
|
||||
|
||||
return _entity_species_path_to_id[path];
|
||||
}
|
||||
|
||||
void ESSResourceDB::clear() {
|
||||
_xp_data.unref();
|
||||
}
|
||||
@ -102,6 +254,30 @@ ESSResourceDB::ESSResourceDB() {
|
||||
|
||||
ESSResourceDB::~ESSResourceDB() {
|
||||
_xp_data.unref();
|
||||
|
||||
_entity_resources_path_to_id.clear();
|
||||
_entity_resources_id_to_path.clear();
|
||||
|
||||
_entity_skill_path_to_id.clear();
|
||||
_entity_skill_id_to_path.clear();
|
||||
|
||||
_entity_data_path_to_id.clear();
|
||||
_entity_data_id_to_path.clear();
|
||||
|
||||
_spell_path_to_id.clear();
|
||||
_spell_id_to_path.clear();
|
||||
|
||||
_aura_path_to_id.clear();
|
||||
_aura_id_to_path.clear();
|
||||
|
||||
_craft_recipe_path_to_id.clear();
|
||||
_craft_recipe_id_to_path.clear();
|
||||
|
||||
_item_template_path_to_id.clear();
|
||||
_item_template_id_to_path.clear();
|
||||
|
||||
_entity_species_path_to_id.clear();
|
||||
_entity_species_id_to_path.clear();
|
||||
}
|
||||
|
||||
void ESSResourceDB::_bind_methods() {
|
||||
@ -124,6 +300,8 @@ void ESSResourceDB::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_entity_resource_count"), &ESSResourceDB::get_entity_resource_count);
|
||||
ClassDB::bind_method(D_METHOD("get_entity_resources"), &ESSResourceDB::get_entity_resources);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_resources", "recipe"), &ESSResourceDB::set_entity_resources);
|
||||
ClassDB::bind_method(D_METHOD("entity_resource_id_to_path", "id"), &ESSResourceDB::entity_resource_id_to_path);
|
||||
ClassDB::bind_method(D_METHOD("entity_resource_path_to_id", "path"), &ESSResourceDB::entity_resource_path_to_id);
|
||||
|
||||
//EntitySkills
|
||||
ClassDB::bind_method(D_METHOD("add_entity_skill", "cls"), &ESSResourceDB::add_entity_skill);
|
||||
@ -132,6 +310,8 @@ void ESSResourceDB::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_entity_skill_count"), &ESSResourceDB::get_entity_skill_count);
|
||||
ClassDB::bind_method(D_METHOD("get_entity_skills"), &ESSResourceDB::get_entity_skills);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_skills", "recipe"), &ESSResourceDB::set_entity_skills);
|
||||
ClassDB::bind_method(D_METHOD("entity_skill_id_to_path", "id"), &ESSResourceDB::entity_skill_id_to_path);
|
||||
ClassDB::bind_method(D_METHOD("entity_skill_path_to_id", "path"), &ESSResourceDB::entity_skill_path_to_id);
|
||||
|
||||
//EntityData
|
||||
ClassDB::bind_method(D_METHOD("add_entity_data", "cls"), &ESSResourceDB::add_entity_data);
|
||||
@ -140,6 +320,8 @@ void ESSResourceDB::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data_count"), &ESSResourceDB::get_entity_data_count);
|
||||
ClassDB::bind_method(D_METHOD("get_entity_datas"), &ESSResourceDB::get_entity_datas);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_datas", "recipe"), &ESSResourceDB::set_entity_skills);
|
||||
ClassDB::bind_method(D_METHOD("entity_data_id_to_path", "id"), &ESSResourceDB::entity_data_id_to_path);
|
||||
ClassDB::bind_method(D_METHOD("entity_data_path_to_id", "path"), &ESSResourceDB::entity_data_path_to_id);
|
||||
|
||||
//Spell
|
||||
ClassDB::bind_method(D_METHOD("add_spell", "spell"), &ESSResourceDB::add_spell);
|
||||
@ -148,6 +330,8 @@ void ESSResourceDB::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_spell_count"), &ESSResourceDB::get_spell_count);
|
||||
ClassDB::bind_method(D_METHOD("get_spells"), &ESSResourceDB::get_spells);
|
||||
ClassDB::bind_method(D_METHOD("set_spells", "recipe"), &ESSResourceDB::set_spells);
|
||||
ClassDB::bind_method(D_METHOD("spell_id_to_path", "id"), &ESSResourceDB::spell_id_to_path);
|
||||
ClassDB::bind_method(D_METHOD("spell_path_to_id", "path"), &ESSResourceDB::spell_path_to_id);
|
||||
|
||||
//Aura
|
||||
ClassDB::bind_method(D_METHOD("add_aura", "spell"), &ESSResourceDB::add_aura);
|
||||
@ -156,6 +340,8 @@ void ESSResourceDB::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_aura_count"), &ESSResourceDB::get_aura_count);
|
||||
ClassDB::bind_method(D_METHOD("get_auras"), &ESSResourceDB::get_auras);
|
||||
ClassDB::bind_method(D_METHOD("set_auras", "recipe"), &ESSResourceDB::set_auras);
|
||||
ClassDB::bind_method(D_METHOD("aura_id_to_path", "id"), &ESSResourceDB::aura_id_to_path);
|
||||
ClassDB::bind_method(D_METHOD("aura_path_to_id", "path"), &ESSResourceDB::aura_path_to_id);
|
||||
|
||||
//Craft Data
|
||||
ClassDB::bind_method(D_METHOD("add_craft_recipe", "craft_recipe"), &ESSResourceDB::add_craft_recipe);
|
||||
@ -164,6 +350,8 @@ void ESSResourceDB::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_craft_recipe_count"), &ESSResourceDB::get_craft_recipe_count);
|
||||
ClassDB::bind_method(D_METHOD("get_craft_recipes"), &ESSResourceDB::get_craft_recipes);
|
||||
ClassDB::bind_method(D_METHOD("set_craft_recipes", "recipe"), &ESSResourceDB::set_craft_recipes);
|
||||
ClassDB::bind_method(D_METHOD("craft_recipe_id_to_path", "id"), &ESSResourceDB::craft_recipe_id_to_path);
|
||||
ClassDB::bind_method(D_METHOD("craft_recipe_path_to_id", "path"), &ESSResourceDB::craft_recipe_path_to_id);
|
||||
|
||||
//Item Templates
|
||||
ClassDB::bind_method(D_METHOD("add_item_template", "item_template"), &ESSResourceDB::add_item_template);
|
||||
@ -172,6 +360,8 @@ void ESSResourceDB::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_item_template_count"), &ESSResourceDB::get_item_template_count);
|
||||
ClassDB::bind_method(D_METHOD("get_item_templates"), &ESSResourceDB::get_item_templates);
|
||||
ClassDB::bind_method(D_METHOD("set_item_templates", "recipe"), &ESSResourceDB::set_item_templates);
|
||||
ClassDB::bind_method(D_METHOD("item_template_id_to_path", "id"), &ESSResourceDB::item_template_id_to_path);
|
||||
ClassDB::bind_method(D_METHOD("item_template_path_to_id", "path"), &ESSResourceDB::item_template_path_to_id);
|
||||
|
||||
//Player Character Data
|
||||
ClassDB::bind_method(D_METHOD("add_entity_species_data", "pcd"), &ESSResourceDB::add_entity_species_data);
|
||||
@ -180,6 +370,8 @@ void ESSResourceDB::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_entity_species_data_count"), &ESSResourceDB::get_entity_species_data_count);
|
||||
ClassDB::bind_method(D_METHOD("get_entity_species_datas"), &ESSResourceDB::get_entity_species_datas);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_species_datas", "recipe"), &ESSResourceDB::set_entity_species_datas);
|
||||
ClassDB::bind_method(D_METHOD("entity_species_id_to_path", "id"), &ESSResourceDB::entity_species_id_to_path);
|
||||
ClassDB::bind_method(D_METHOD("entity_species_path_to_id", "path"), &ESSResourceDB::entity_species_path_to_id);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("clear"), &ESSResourceDB::clear);
|
||||
ClassDB::bind_method(D_METHOD("add_entity_resource_db", "other"), &ESSResourceDB::add_entity_resource_db);
|
||||
|
@ -36,6 +36,8 @@ SOFTWARE.
|
||||
|
||||
#include "../data/entities/xp_data.h"
|
||||
|
||||
#include "core/hash_map.h"
|
||||
|
||||
class Aura;
|
||||
class Spell;
|
||||
class EntityData;
|
||||
@ -60,58 +62,74 @@ public:
|
||||
virtual Ref<EntityResourceData> get_entity_resource(int class_id) = 0;
|
||||
virtual Ref<EntityResourceData> get_entity_resource_index(int index) = 0;
|
||||
virtual int get_entity_resource_count() = 0;
|
||||
virtual void add_entity_resource(Ref<EntityResourceData> cls) = 0;
|
||||
virtual void add_entity_resource(Ref<EntityResourceData> cls);
|
||||
virtual Vector<Variant> get_entity_resources() const = 0;
|
||||
virtual void set_entity_resources(const Vector<Variant> &data) = 0;
|
||||
StringName entity_resource_id_to_path(const int id) const;
|
||||
int entity_resource_path_to_id(const StringName &path) const;
|
||||
|
||||
virtual Ref<EntitySkillData> get_entity_skill(int class_id) = 0;
|
||||
virtual Ref<EntitySkillData> get_entity_skill_index(int index) = 0;
|
||||
virtual int get_entity_skill_count() = 0;
|
||||
virtual void add_entity_skill(Ref<EntitySkillData> cls) = 0;
|
||||
virtual void add_entity_skill(Ref<EntitySkillData> cls);
|
||||
virtual Vector<Variant> get_entity_skills() const = 0;
|
||||
virtual void set_entity_skills(const Vector<Variant> &data) = 0;
|
||||
StringName entity_skill_id_to_path(const int id) const;
|
||||
int entity_skill_path_to_id(const StringName &path) const;
|
||||
|
||||
virtual Ref<EntityData> get_entity_data(int class_id) = 0;
|
||||
virtual Ref<EntityData> get_entity_data_index(int index) = 0;
|
||||
virtual int get_entity_data_count() = 0;
|
||||
virtual void add_entity_data(Ref<EntityData> cls) = 0;
|
||||
virtual void add_entity_data(Ref<EntityData> cls);
|
||||
virtual Vector<Variant> get_entity_datas() const = 0;
|
||||
virtual void set_entity_datas(const Vector<Variant> &data) = 0;
|
||||
StringName entity_data_id_to_path(const int id) const;
|
||||
int entity_data_path_to_id(const StringName &path) const;
|
||||
|
||||
virtual Ref<Spell> get_spell(int spell_id) = 0;
|
||||
virtual Ref<Spell> get_spell_index(int index) = 0;
|
||||
virtual int get_spell_count() = 0;
|
||||
virtual void add_spell(Ref<Spell> spell) = 0;
|
||||
virtual void add_spell(Ref<Spell> spell);
|
||||
virtual Vector<Variant> get_spells() const = 0;
|
||||
virtual void set_spells(const Vector<Variant> &data) = 0;
|
||||
StringName spell_id_to_path(const int id) const;
|
||||
int spell_path_to_id(const StringName &path) const;
|
||||
|
||||
virtual Ref<Aura> get_aura(int aura_id) = 0;
|
||||
virtual Ref<Aura> get_aura_index(int index) = 0;
|
||||
virtual int get_aura_count() = 0;
|
||||
virtual void add_aura(Ref<Aura> aura) = 0;
|
||||
virtual void add_aura(Ref<Aura> aura);
|
||||
virtual Vector<Variant> get_auras() const = 0;
|
||||
virtual void set_auras(const Vector<Variant> &data) = 0;
|
||||
StringName aura_id_to_path(const int id) const;
|
||||
int aura_path_to_id(const StringName &path) const;
|
||||
|
||||
virtual Ref<CraftRecipe> get_craft_recipe(int craft_id) = 0;
|
||||
virtual Ref<CraftRecipe> get_craft_recipe_index(int index) = 0;
|
||||
virtual int get_craft_recipe_count() = 0;
|
||||
virtual void add_craft_recipe(Ref<CraftRecipe> aura) = 0;
|
||||
virtual void add_craft_recipe(Ref<CraftRecipe> aura);
|
||||
virtual Vector<Variant> get_craft_recipes() const = 0;
|
||||
virtual void set_craft_recipes(const Vector<Variant> &data) = 0;
|
||||
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<ItemTemplate> aura) = 0;
|
||||
virtual void add_item_template(Ref<ItemTemplate> aura);
|
||||
virtual Ref<ItemTemplate> get_item_template(int item_id) = 0;
|
||||
virtual Ref<ItemTemplate> get_item_template_index(int index) = 0;
|
||||
virtual int get_item_template_count() = 0;
|
||||
virtual Vector<Variant> get_item_templates() const = 0;
|
||||
virtual void set_item_templates(const Vector<Variant> &data) = 0;
|
||||
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<EntitySpeciesData> aura) = 0;
|
||||
virtual void add_entity_species_data(Ref<EntitySpeciesData> aura);
|
||||
virtual Ref<EntitySpeciesData> get_entity_species_data(int item_id) = 0;
|
||||
virtual Ref<EntitySpeciesData> get_entity_species_data_index(int index) = 0;
|
||||
virtual int get_entity_species_data_count() = 0;
|
||||
virtual Vector<Variant> get_entity_species_datas() const = 0;
|
||||
virtual void set_entity_species_datas(const Vector<Variant> &data) = 0;
|
||||
StringName entity_species_id_to_path(const int id) const;
|
||||
int entity_species_path_to_id(const StringName &path) const;
|
||||
|
||||
virtual void clear();
|
||||
|
||||
@ -125,10 +143,33 @@ public:
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
Ref<XPData> _xp_data;
|
||||
|
||||
Ref<Aura> _armor_type_skills[ItemEnums::ARMOR_TYPE_MAX];
|
||||
|
||||
HashMap<int, StringName> _entity_resources_id_to_path;
|
||||
HashMap<StringName, int> _entity_resources_path_to_id;
|
||||
|
||||
HashMap<int, StringName> _entity_skill_id_to_path;
|
||||
HashMap<StringName, int> _entity_skill_path_to_id;
|
||||
|
||||
HashMap<int, StringName> _entity_data_id_to_path;
|
||||
HashMap<StringName, int> _entity_data_path_to_id;
|
||||
|
||||
HashMap<int, StringName> _spell_id_to_path;
|
||||
HashMap<StringName, int> _spell_path_to_id;
|
||||
|
||||
HashMap<int, StringName> _aura_id_to_path;
|
||||
HashMap<StringName, int> _aura_path_to_id;
|
||||
|
||||
HashMap<int, StringName> _craft_recipe_id_to_path;
|
||||
HashMap<StringName, int> _craft_recipe_path_to_id;
|
||||
|
||||
HashMap<int, StringName> _item_template_id_to_path;
|
||||
HashMap<StringName, int> _item_template_path_to_id;
|
||||
|
||||
HashMap<int, StringName> _entity_species_id_to_path;
|
||||
HashMap<StringName, int> _entity_species_path_to_id;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -52,6 +52,8 @@ void ESSResourceDBMap::add_entity_resource(Ref<EntityResourceData> cls) {
|
||||
|
||||
_entity_resources.push_back(cls);
|
||||
_entity_resource_map.set(cls->get_id(), cls);
|
||||
|
||||
ESSResourceDB::add_entity_resource(cls);
|
||||
}
|
||||
Vector<Variant> ESSResourceDBMap::get_entity_resources() const {
|
||||
Vector<Variant> r;
|
||||
@ -94,6 +96,8 @@ void ESSResourceDBMap::add_entity_skill(Ref<EntitySkillData> cls) {
|
||||
|
||||
_entity_skills.push_back(cls);
|
||||
_entity_skill_map.set(cls->get_id(), cls);
|
||||
|
||||
ESSResourceDB::add_entity_skill(cls);
|
||||
}
|
||||
Vector<Variant> ESSResourceDBMap::get_entity_skills() const {
|
||||
Vector<Variant> r;
|
||||
@ -136,6 +140,8 @@ void ESSResourceDBMap::add_entity_data(Ref<EntityData> cls) {
|
||||
|
||||
_entity_datas.push_back(cls);
|
||||
_entity_data_map.set(cls->get_id(), cls);
|
||||
|
||||
ESSResourceDB::add_entity_data(cls);
|
||||
}
|
||||
Vector<Variant> ESSResourceDBMap::get_entity_datas() const {
|
||||
Vector<Variant> r;
|
||||
@ -179,6 +185,8 @@ void ESSResourceDBMap::add_spell(Ref<Spell> spell) {
|
||||
|
||||
_spells.push_back(spell);
|
||||
_spell_map.set(spell->get_id(), spell);
|
||||
|
||||
ESSResourceDB::add_spell(spell);
|
||||
}
|
||||
Vector<Variant> ESSResourceDBMap::get_spells() const {
|
||||
Vector<Variant> r;
|
||||
@ -208,6 +216,8 @@ void ESSResourceDBMap::add_aura(Ref<Aura> aura) {
|
||||
|
||||
_auras.push_back(aura);
|
||||
_aura_map.set(aura->get_id(), aura);
|
||||
_aura_id_to_path.set(aura->get_id(), aura->get_path());
|
||||
_aura_path_to_id.set(aura->get_path(), aura->get_id());
|
||||
}
|
||||
|
||||
Ref<Aura> ESSResourceDBMap::get_aura(int aura_id) {
|
||||
@ -255,6 +265,8 @@ void ESSResourceDBMap::add_craft_recipe(Ref<CraftRecipe> cda) {
|
||||
|
||||
_craft_recipes.push_back(cda);
|
||||
_craft_recipe_map.set(cda->get_id(), cda);
|
||||
|
||||
ESSResourceDB::add_craft_recipe(cda);
|
||||
}
|
||||
|
||||
Ref<CraftRecipe> ESSResourceDBMap::get_craft_recipe(int craft_id) {
|
||||
@ -301,6 +313,8 @@ void ESSResourceDBMap::add_item_template(Ref<ItemTemplate> cda) {
|
||||
|
||||
_item_templates.push_back(cda);
|
||||
_item_template_map.set(cda->get_id(), cda);
|
||||
|
||||
ESSResourceDB::add_item_template(cda);
|
||||
}
|
||||
|
||||
Ref<ItemTemplate> ESSResourceDBMap::get_item_template(int item_id) {
|
||||
@ -346,6 +360,8 @@ void ESSResourceDBMap::add_entity_species_data(Ref<EntitySpeciesData> cda) {
|
||||
|
||||
_entity_species_datas.push_back(cda);
|
||||
_entity_species_data_map.set(cda->get_id(), cda);
|
||||
|
||||
ESSResourceDB::add_entity_species_data(cda);
|
||||
}
|
||||
Ref<EntitySpeciesData> ESSResourceDBMap::get_entity_species_data(int item_id) {
|
||||
if (!_entity_species_data_map.has(item_id))
|
||||
|
@ -56,6 +56,8 @@ void ESSResourceDBStatic::add_entity_resource(Ref<EntityResourceData> cls) {
|
||||
cls->set_id(_entity_resources.size());
|
||||
|
||||
_entity_resources.push_back(cls);
|
||||
|
||||
ESSResourceDB::add_entity_resource(cls);
|
||||
}
|
||||
Vector<Variant> ESSResourceDBStatic::get_entity_resources() const {
|
||||
Vector<Variant> r;
|
||||
@ -96,6 +98,8 @@ void ESSResourceDBStatic::add_entity_skill(Ref<EntitySkillData> cls) {
|
||||
cls->set_id(_entity_skills.size());
|
||||
|
||||
_entity_skills.push_back(cls);
|
||||
|
||||
ESSResourceDB::add_entity_skill(cls);
|
||||
}
|
||||
Vector<Variant> ESSResourceDBStatic::get_entity_skills() const {
|
||||
Vector<Variant> r;
|
||||
@ -136,6 +140,8 @@ void ESSResourceDBStatic::add_entity_data(Ref<EntityData> cls) {
|
||||
cls->set_id(_entity_datas.size());
|
||||
|
||||
_entity_datas.push_back(cls);
|
||||
|
||||
ESSResourceDB::add_entity_data(cls);
|
||||
}
|
||||
Vector<Variant> ESSResourceDBStatic::get_entity_datas() const {
|
||||
Vector<Variant> r;
|
||||
@ -177,6 +183,8 @@ void ESSResourceDBStatic::add_spell(Ref<Spell> spell) {
|
||||
spell->set_id(_spells.size());
|
||||
|
||||
_spells.push_back(spell);
|
||||
|
||||
ESSResourceDB::add_spell(spell);
|
||||
}
|
||||
Vector<Variant> ESSResourceDBStatic::get_spells() const {
|
||||
Vector<Variant> r;
|
||||
@ -203,6 +211,8 @@ void ESSResourceDBStatic::add_aura(Ref<Aura> aura) {
|
||||
aura->set_id(_auras.size());
|
||||
|
||||
_auras.push_back(aura);
|
||||
|
||||
ESSResourceDB::add_aura(aura);
|
||||
}
|
||||
|
||||
Ref<Aura> ESSResourceDBStatic::get_aura(int id) {
|
||||
@ -248,6 +258,8 @@ void ESSResourceDBStatic::add_craft_recipe(Ref<CraftRecipe> cda) {
|
||||
cda->set_id(_craft_recipes.size());
|
||||
|
||||
_craft_recipes.push_back(cda);
|
||||
|
||||
ESSResourceDB::add_craft_recipe(cda);
|
||||
}
|
||||
|
||||
Ref<CraftRecipe> ESSResourceDBStatic::get_craft_recipe(int id) {
|
||||
@ -292,6 +304,8 @@ void ESSResourceDBStatic::add_item_template(Ref<ItemTemplate> cda) {
|
||||
cda->set_id(_item_templates.size());
|
||||
|
||||
_item_templates.push_back(cda);
|
||||
|
||||
ESSResourceDB::add_item_template(cda);
|
||||
}
|
||||
|
||||
Ref<ItemTemplate> ESSResourceDBStatic::get_item_template(int item_id) {
|
||||
@ -335,6 +349,8 @@ void ESSResourceDBStatic::add_entity_species_data(Ref<EntitySpeciesData> cda) {
|
||||
cda->set_id(_entity_species_datas.size());
|
||||
|
||||
_entity_species_datas.push_back(cda);
|
||||
|
||||
ESSResourceDB::add_entity_species_data(cda);
|
||||
}
|
||||
Ref<EntitySpeciesData> ESSResourceDBStatic::get_entity_species_data(int id) {
|
||||
if (id < 0 || id > _entity_species_datas.size())
|
||||
|
Loading…
Reference in New Issue
Block a user