From f819668ab08e77d524c600b612e0d3ea7160ab04 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 6 Oct 2019 17:18:44 +0200 Subject: [PATCH] Removed spell's next rank member, and a bit more work on the talent management functions. --- data/spell.cpp | 11 ----------- data/spell.h | 4 ---- entities/entity.cpp | 25 +++++++++++++++++++++++++ 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/data/spell.cpp b/data/spell.cpp index 69a7c70..61cf935 100644 --- a/data/spell.cpp +++ b/data/spell.cpp @@ -66,13 +66,6 @@ void Spell::set_rank(int value) { _rank = value; } -Ref Spell::get_next_rank() { - return _next_rank; -} -void Spell::set_next_rank(Ref value) { - _next_rank = value; -} - int Spell::get_item_cost() { return _item_cost; } @@ -907,10 +900,6 @@ void Spell::_bind_methods() { ClassDB::bind_method(D_METHOD("set_rank", "value"), &Spell::set_rank); ADD_PROPERTY(PropertyInfo(Variant::INT, "rank"), "set_rank", "get_rank"); - ClassDB::bind_method(D_METHOD("get_next_rank"), &Spell::get_next_rank); - ClassDB::bind_method(D_METHOD("set_next_rank", "value"), &Spell::set_next_rank); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "next_rank", PROPERTY_HINT_RESOURCE_TYPE, "Spell"), "set_next_rank", "get_next_rank"); - ClassDB::bind_method(D_METHOD("get_is_local_spell"), &Spell::get_is_local_spell); ClassDB::bind_method(D_METHOD("set_is_local_spell", "value"), &Spell::set_is_local_spell); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "is_local_spell"), "set_is_local_spell", "get_is_local_spell"); diff --git a/data/spell.h b/data/spell.h index 3963e36..3ed525a 100644 --- a/data/spell.h +++ b/data/spell.h @@ -110,9 +110,6 @@ public: int get_rank(); void set_rank(int value); - Ref get_next_rank(); - void set_next_rank(Ref value); - int get_item_cost(); void set_item_cost(int value); @@ -360,7 +357,6 @@ private: int _level; int _rank; - Ref _next_rank; int _item_cost; int _craft_material_cost; int _required_item; diff --git a/entities/entity.cpp b/entities/entity.cpp index 5deb8ba..5fdaa5f 100644 --- a/entities/entity.cpp +++ b/entities/entity.cpp @@ -3395,6 +3395,20 @@ void Entity::_sreceive_talent_learn_request(int spec_index, int talent_row, int } } + if (i > 0) { + Ref pt = tr->get_talent(talent_culomn, i - 1); + + for (int j = 0; j < sget_aura_count(); ++j) { + Ref ad = sget_aura(j); + + if (ad->get_aura_id() == pt->get_id()) { + sremove_aura(ad); + + break; + } + } + } + Ref info; info.instance(); @@ -3458,6 +3472,17 @@ void Entity::removes_talent(int talent) { for (int i = 0; i < _s_talents.size(); ++i) { if (_s_talents[i] == talent) { _s_talents.remove(i); + + for (int j = 0; j < sget_aura_count(); ++j) { + Ref ad = sget_aura(j); + + if (ad->get_aura_id() == talent) { + sremove_aura(ad); + + break; + } + } + break; } }