mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-04-19 21:33:15 +02:00
Added similar api to Items. And fix typo.
This commit is contained in:
parent
a040f946fc
commit
ceb71f56d4
@ -1593,7 +1593,7 @@ void Aura::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_name"), "set_name", "get_name");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_text_translation_key"), &Aura::get_text_translation_key);
|
||||
ClassDB::bind_method(D_METHOD("set_text_translation_key", "value"), &Aura::set_text_description);
|
||||
ClassDB::bind_method(D_METHOD("set_text_translation_key", "value"), &Aura::set_text_translation_key);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_translation_key"), "set_text_translation_key", "get_text_translation_key");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_text_description"), &Aura::get_text_description);
|
||||
|
@ -76,6 +76,13 @@ void ItemInstance::set_charges(const int value) {
|
||||
emit_signal("stack_charges_changed", Ref<ItemInstance>(this));
|
||||
}
|
||||
|
||||
String ItemInstance::get_description() {
|
||||
if (!has_method("_get_description"))
|
||||
return "";
|
||||
|
||||
return call("_get_description");
|
||||
}
|
||||
|
||||
Dictionary ItemInstance::to_dict() {
|
||||
return call("_to_dict");
|
||||
}
|
||||
@ -154,6 +161,9 @@ void ItemInstance::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("clear_item_stat_modifiers"), &ItemInstance::clear_item_stat_modifiers);
|
||||
ClassDB::bind_method(D_METHOD("get_item_stat_modifier_count"), &ItemInstance::get_item_stat_modifier_count);
|
||||
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::STRING, "desc"), "_get_description"));
|
||||
ClassDB::bind_method(D_METHOD("get_description"), &ItemInstance::get_description);
|
||||
|
||||
//Serialization
|
||||
BIND_VMETHOD(MethodInfo("_from_dict", PropertyInfo(Variant::DICTIONARY, "dict")));
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::DICTIONARY, "dict"), "_to_dict"));
|
||||
|
@ -52,6 +52,8 @@ public:
|
||||
int get_charges() const;
|
||||
void set_charges(const int value);
|
||||
|
||||
String get_description();
|
||||
|
||||
Dictionary to_dict();
|
||||
void from_dict(const Dictionary &dict);
|
||||
|
||||
|
@ -144,6 +144,15 @@ void ItemTemplate::set_bag_size(const int size) {
|
||||
_bag_size = size;
|
||||
}
|
||||
|
||||
/// TEXTS ////
|
||||
|
||||
String ItemTemplate::get_text_translation_key() const {
|
||||
return _text_translation_key;
|
||||
}
|
||||
void ItemTemplate::set_text_translation_key(const String &value) {
|
||||
_text_translation_key = value;
|
||||
}
|
||||
|
||||
//// TEACHES ////
|
||||
|
||||
int ItemTemplate::get_num_teaches_spells() const {
|
||||
@ -418,6 +427,13 @@ Ref<ItemInstance> ItemTemplate::create_item_instance() {
|
||||
return item;
|
||||
}
|
||||
|
||||
String ItemTemplate::get_description() {
|
||||
if (!has_method("_get_description"))
|
||||
return "";
|
||||
|
||||
return call("_get_description");
|
||||
}
|
||||
|
||||
ItemTemplate::ItemTemplate() {
|
||||
_id = 0;
|
||||
_item_type = ItemEnums::ITEM_TYPE_NONE;
|
||||
@ -470,8 +486,6 @@ void ItemTemplate::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_id", "count"), &ItemTemplate::set_id);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_name"), "set_name", "get_name");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_item_type"), &ItemTemplate::get_item_type);
|
||||
ClassDB::bind_method(D_METHOD("set_item_type", "count"), &ItemTemplate::set_item_type);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "item_type", PROPERTY_HINT_ENUM, ItemEnums::BINDING_STRING_ITEM_TYPE), "set_item_type", "get_item_type");
|
||||
@ -584,6 +598,16 @@ void ItemTemplate::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_consumed", "size"), &ItemTemplate::set_consumed);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "consumed"), "set_consumed", "get_consumed");
|
||||
|
||||
ADD_GROUP("Texts", "text");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_name"), "set_name", "get_name");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_text_translation_key"), &ItemTemplate::get_text_translation_key);
|
||||
ClassDB::bind_method(D_METHOD("set_text_translation_key", "value"), &ItemTemplate::set_text_translation_key);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_translation_key"), "set_text_translation_key", "get_text_translation_key");
|
||||
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::STRING, "desc"), "_get_description"));
|
||||
ClassDB::bind_method(D_METHOD("get_description"), &ItemTemplate::get_description);
|
||||
|
||||
//StatMods Property binds
|
||||
ClassDB::bind_method(D_METHOD("get_item_stat_modifier_count"), &ItemTemplate::get_item_stat_modifier_count);
|
||||
ClassDB::bind_method(D_METHOD("set_item_stat_modifier_count", "count"), &ItemTemplate::set_item_stat_modifier_count);
|
||||
|
@ -89,6 +89,9 @@ public:
|
||||
int get_bag_size() const;
|
||||
void set_bag_size(const int size);
|
||||
|
||||
String get_text_translation_key() const;
|
||||
void set_text_translation_key(const String &value);
|
||||
|
||||
//Teaches
|
||||
int get_num_teaches_spells() const;
|
||||
void set_num_teaches_spells(const int value);
|
||||
@ -167,6 +170,8 @@ public:
|
||||
|
||||
Ref<ItemInstance> create_item_instance();
|
||||
|
||||
String get_description();
|
||||
|
||||
ItemTemplate();
|
||||
~ItemTemplate();
|
||||
|
||||
@ -208,6 +213,8 @@ private:
|
||||
|
||||
int _bag_size;
|
||||
|
||||
String _text_translation_key;
|
||||
|
||||
Vector<Ref<Spell> > _teaches_spells;
|
||||
Vector<Ref<Spell> > _grants_spells;
|
||||
Vector<Ref<Aura> > _auras;
|
||||
|
Loading…
Reference in New Issue
Block a user