diff --git a/data/aura.cpp b/data/aura.cpp index 16c4bed..340c372 100644 --- a/data/aura.cpp +++ b/data/aura.cpp @@ -501,6 +501,14 @@ void Aura::son_cast_finished_target(Ref aura, Ref info) call("_son_cast_finished_target", aura, info); } +void Aura::son_spell_cast_success(Ref aura, Ref info) { + ERR_FAIL_COND(!aura.is_valid()); + ERR_FAIL_COND(!info.is_valid()); + + if (has_method("_son_spell_cast_success")) + call("_son_spell_cast_success", aura, info); +} + void Aura::son_before_damage_hit(Ref aura, Ref data) { ERR_FAIL_COND(!aura.is_valid()); ERR_FAIL_COND(!data.is_valid()); @@ -1063,6 +1071,7 @@ void Aura::_bind_methods() { ClassDB::bind_method(D_METHOD("son_cast_failed", "aura", "info"), &Aura::son_cast_failed); ClassDB::bind_method(D_METHOD("son_cast_finished", "aura", "info"), &Aura::son_cast_finished); ClassDB::bind_method(D_METHOD("son_cast_finished_target", "aura", "info"), &Aura::son_cast_finished_target); + ClassDB::bind_method(D_METHOD("son_spell_cast_success", "aura", "info"), &Aura::son_spell_cast_success); ClassDB::bind_method(D_METHOD("son_before_damage_hit", "aura", "data"), &Aura::son_before_damage_hit); ClassDB::bind_method(D_METHOD("son_hit", "aura", "data"), &Aura::son_hit); @@ -1106,6 +1115,7 @@ void Aura::_bind_methods() { BIND_VMETHOD(MethodInfo("_son_cast_failed", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); BIND_VMETHOD(MethodInfo("_son_cast_finished", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); BIND_VMETHOD(MethodInfo("_son_cast_finished_target", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); + BIND_VMETHOD(MethodInfo("_son_spell_cast_success", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); BIND_VMETHOD(MethodInfo("_son_before_damage_hit", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); BIND_VMETHOD(MethodInfo("_son_hit", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); diff --git a/data/aura.h b/data/aura.h index f50beaf..cbd632d 100644 --- a/data/aura.h +++ b/data/aura.h @@ -223,6 +223,7 @@ public: void son_cast_failed(Ref aura, Ref info); void son_cast_finished(Ref aura, Ref info); void son_cast_finished_target(Ref aura, Ref info); + void son_spell_cast_success(Ref aura, Ref info); void son_before_damage_hit(Ref aura, Ref data); void son_hit(Ref aura, Ref data); diff --git a/entities/data/entity_class_data.cpp b/entities/data/entity_class_data.cpp index 3ffbc7b..e24d452 100644 --- a/entities/data/entity_class_data.cpp +++ b/entities/data/entity_class_data.cpp @@ -312,6 +312,13 @@ void EntityClassData::son_cast_failed(Ref info) { call("_son_cast_failed", info); } +void EntityClassData::son_spell_cast_success(Ref info) { + ERR_FAIL_COND(!info.is_valid()); + + if (has_method("_son_spell_cast_success")) + call("_son_spell_cast_success", info); +} + void EntityClassData::son_cast_finished_target(Ref info) { ERR_FAIL_COND(!info.is_valid()); @@ -762,6 +769,7 @@ void EntityClassData::_bind_methods() { ClassDB::bind_method(D_METHOD("son_cast_failed", "info"), &EntityClassData::son_cast_failed); ClassDB::bind_method(D_METHOD("son_cast_finished", "info"), &EntityClassData::son_cast_finished); ClassDB::bind_method(D_METHOD("son_cast_finished_target", "info"), &EntityClassData::son_cast_finished_target); + ClassDB::bind_method(D_METHOD("son_spell_cast_success", "info"), &EntityClassData::son_spell_cast_success); ClassDB::bind_method(D_METHOD("son_before_damage_hit", "data"), &EntityClassData::son_before_damage_hit); ClassDB::bind_method(D_METHOD("son_hit", "data"), &EntityClassData::son_hit); @@ -799,6 +807,7 @@ void EntityClassData::_bind_methods() { BIND_VMETHOD(MethodInfo("_son_cast_failed", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); BIND_VMETHOD(MethodInfo("_son_cast_finished", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); BIND_VMETHOD(MethodInfo("_son_cast_finished_target", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); + BIND_VMETHOD(MethodInfo("_son_spell_cast_success", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); BIND_VMETHOD(MethodInfo("_son_before_damage_hit", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); BIND_VMETHOD(MethodInfo("_son_hit", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); diff --git a/entities/data/entity_class_data.h b/entities/data/entity_class_data.h index ee36ec1..b44fbe0 100644 --- a/entities/data/entity_class_data.h +++ b/entities/data/entity_class_data.h @@ -106,6 +106,7 @@ public: void son_cast_finished(Ref info); void son_cast_started(Ref info); void son_cast_failed(Ref info); + void son_spell_cast_success(Ref info); void son_before_damage_hit(Ref data); void son_hit(Ref data); diff --git a/entities/data/entity_data.cpp b/entities/data/entity_data.cpp index db2501a..03ab0ee 100644 --- a/entities/data/entity_data.cpp +++ b/entities/data/entity_data.cpp @@ -256,6 +256,16 @@ void EntityData::son_cast_failed(Ref info) { call("_son_cast_failed", info); } +void EntityData::son_spell_cast_success(Ref info) { + ERR_FAIL_COND(!info.is_valid()); + + if (_entity_class_data.is_valid()) + _entity_class_data->son_spell_cast_success(info); + + if (has_method("_son_spell_cast_success")) + call("_son_spell_cast_success", info); +} + void EntityData::son_cast_finished_target(Ref info) { ERR_FAIL_COND(!info.is_valid()); @@ -852,6 +862,7 @@ void EntityData::_bind_methods() { ClassDB::bind_method(D_METHOD("son_cast_failed", "info"), &EntityData::son_cast_failed); ClassDB::bind_method(D_METHOD("son_cast_finished", "info"), &EntityData::son_cast_finished); ClassDB::bind_method(D_METHOD("son_cast_finished_target", "info"), &EntityData::son_cast_finished_target); + ClassDB::bind_method(D_METHOD("son_spell_cast_success", "info"), &EntityData::son_spell_cast_success); ClassDB::bind_method(D_METHOD("son_before_damage_hit", "data"), &EntityData::son_before_damage_hit); ClassDB::bind_method(D_METHOD("son_hit", "data"), &EntityData::son_hit); @@ -889,6 +900,7 @@ void EntityData::_bind_methods() { BIND_VMETHOD(MethodInfo("_son_cast_failed", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); BIND_VMETHOD(MethodInfo("_son_cast_finished", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); BIND_VMETHOD(MethodInfo("_son_cast_finished_target", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); + BIND_VMETHOD(MethodInfo("_son_spell_cast_success", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); BIND_VMETHOD(MethodInfo("_son_before_damage_hit", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); BIND_VMETHOD(MethodInfo("_son_hit", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); diff --git a/entities/data/entity_data.h b/entities/data/entity_data.h index f7e1be0..d01d136 100644 --- a/entities/data/entity_data.h +++ b/entities/data/entity_data.h @@ -112,6 +112,7 @@ public: void son_cast_finished(Ref info); void son_cast_started(Ref info); void son_cast_failed(Ref info); + void son_spell_cast_success(Ref info); void son_before_damage_hit(Ref data); void son_hit(Ref data); diff --git a/entities/entity.cpp b/entities/entity.cpp index 5e1b662..ca9c0f8 100644 --- a/entities/entity.cpp +++ b/entities/entity.cpp @@ -1720,6 +1720,25 @@ void Entity::son_cast_finished_target(Ref info) { } } +void Entity::son_spell_cast_success(Ref info) { + ERR_FAIL_COND(!info.is_valid()); + + if (_s_entity_data.is_valid()) { + _s_entity_data->son_spell_cast_success(info); + } + + if (has_method("_son_spell_cast_success")) + call("_son_spell_cast_success", info); + + for (int i = 0; i < _s_auras.size(); ++i) { + Ref ad = _s_auras.get(i); + + ad->get_aura()->son_spell_cast_success(ad, info); + } + + emit_signal("sspell_cast_success", info); +} + void Entity::son_death() { if (_s_entity_data.is_valid()) { _s_entity_data->son_death(this); @@ -2307,6 +2326,8 @@ void Entity::con_spell_cast_success(Ref info) { if (has_method("_con_spell_cast_success")) call("_con_spell_cast_success", info); + + emit_signal("cspell_cast_success", info); } void Entity::con_death() { @@ -2573,11 +2594,7 @@ void Entity::sstart_casting(Ref info) { } void Entity::sfail_cast() { - for (int i = 0; i < _s_auras.size(); ++i) { - Ref ad = _s_auras.get(i); - - ad->get_aura()->son_before_cast(ad, _s_spell_cast_info); - } + son_cast_failed(_s_spell_cast_info); emit_signal("scast_failed", _s_spell_cast_info); @@ -2587,27 +2604,16 @@ void Entity::sfail_cast() { } void Entity::sdelay_cast() { - for (int i = 0; i < _s_auras.size(); ++i) { - Ref ad = _s_auras.get(i); - - ad->get_aura()->son_before_cast(ad, _s_spell_cast_info); - } - emit_signal("scast_delayed", _s_spell_cast_info); SEND_RPC(rpc("cdelay_cast"), cdelay_cast()); } void Entity::sfinish_cast() { - - for (int i = 0; i < _s_auras.size(); ++i) { - Ref ad = _s_auras.get(i); - - ad->get_aura()->son_cast_finished(ad, _s_spell_cast_info); - } - _s_spell_cast_info->get_spell()->sfinish_cast(_s_spell_cast_info); + son_cast_finished(_s_spell_cast_info); + emit_signal("scast_finished", _s_spell_cast_info); _s_spell_cast_info.unref(); @@ -2664,6 +2670,17 @@ void Entity::cinterrupt_cast() { _c_spell_cast_info.unref(); } + +void Entity::sspell_cast_success(Ref info) { + son_spell_cast_success(info); + + SEND_RPC(rpc("csspell_cast_success", info), cspell_cast_success(info)); +} + +void Entity::cspell_cast_success(Ref info) { + con_spell_cast_success(info); +} + //// Cooldowns //// Vector > *Entity::gets_cooldowns() { return &_s_cooldowns; @@ -3622,12 +3639,14 @@ void Entity::_bind_methods() { ADD_SIGNAL(MethodInfo("scast_delayed", PropertyInfo(Variant::OBJECT, "spell_cast_info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); ADD_SIGNAL(MethodInfo("scast_finished", PropertyInfo(Variant::OBJECT, "spell_cast_info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); ADD_SIGNAL(MethodInfo("scast_interrupted", PropertyInfo(Variant::OBJECT, "spell_cast_info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); + ADD_SIGNAL(MethodInfo("sspell_cast_success", PropertyInfo(Variant::OBJECT, "spell_cast_info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); ADD_SIGNAL(MethodInfo("ccast_started", PropertyInfo(Variant::OBJECT, "spell_cast_info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); ADD_SIGNAL(MethodInfo("ccast_failed", PropertyInfo(Variant::OBJECT, "spell_cast_info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); ADD_SIGNAL(MethodInfo("ccast_delayed", PropertyInfo(Variant::OBJECT, "spell_cast_info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); ADD_SIGNAL(MethodInfo("ccast_finished", PropertyInfo(Variant::OBJECT, "spell_cast_info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); ADD_SIGNAL(MethodInfo("ccast_interrupted", PropertyInfo(Variant::OBJECT, "spell_cast_info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); + ADD_SIGNAL(MethodInfo("cspell_cast_success", PropertyInfo(Variant::OBJECT, "spell_cast_info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); //Aura signals ADD_SIGNAL(MethodInfo("saura_added", PropertyInfo(Variant::OBJECT, "aura_data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"))); @@ -3686,6 +3705,7 @@ void Entity::_bind_methods() { BIND_VMETHOD(MethodInfo("_son_cast_failed", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); BIND_VMETHOD(MethodInfo("_son_cast_finished", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); BIND_VMETHOD(MethodInfo("_son_cast_finished_target", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); + BIND_VMETHOD(MethodInfo("_son_spell_cast_success", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); BIND_VMETHOD(MethodInfo("_son_before_damage_hit", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); BIND_VMETHOD(MethodInfo("_son_hit", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); @@ -3740,6 +3760,7 @@ void Entity::_bind_methods() { ClassDB::bind_method(D_METHOD("son_cast_finished", "info"), &Entity::son_cast_finished); ClassDB::bind_method(D_METHOD("son_cast_started", "info"), &Entity::son_cast_started); ClassDB::bind_method(D_METHOD("son_cast_failed", "info"), &Entity::son_cast_failed); + ClassDB::bind_method(D_METHOD("son_spell_cast_success", "info"), &Entity::son_spell_cast_success); ClassDB::bind_method(D_METHOD("son_death"), &Entity::son_death); @@ -3790,6 +3811,8 @@ void Entity::_bind_methods() { ClassDB::bind_method(D_METHOD("con_cast_started", "info"), &Entity::con_cast_started); ClassDB::bind_method(D_METHOD("con_cast_state_changed", "info"), &Entity::con_cast_state_changed); ClassDB::bind_method(D_METHOD("con_cast_finished", "info"), &Entity::con_cast_finished); + ClassDB::bind_method(D_METHOD("cspell_cast_success", "info"), &Entity::cspell_cast_success); + ClassDB::bind_method(D_METHOD("con_spell_cast_success", "info"), &Entity::con_spell_cast_success); ClassDB::bind_method(D_METHOD("con_death"), &Entity::con_death); @@ -4084,6 +4107,7 @@ void Entity::_bind_methods() { ClassDB::bind_method(D_METHOD("cdelay_cast"), &Entity::cdelay_cast); ClassDB::bind_method(D_METHOD("cfinish_cast"), &Entity::cfinish_cast); ClassDB::bind_method(D_METHOD("cinterrupt_cast"), &Entity::cinterrupt_cast); + ClassDB::bind_method(D_METHOD("sspell_cast_success", "info"), &Entity::sspell_cast_success); //Cooldowns ADD_SIGNAL(MethodInfo("scooldown_added", PropertyInfo(Variant::OBJECT, "cooldown", PROPERTY_HINT_RESOURCE_TYPE, "Cooldown"))); diff --git a/entities/entity.h b/entities/entity.h index 02ed2e7..9089840 100644 --- a/entities/entity.h +++ b/entities/entity.h @@ -302,6 +302,7 @@ public: void son_cast_finished(Ref info); void son_cast_started(Ref info); void son_cast_failed(Ref info); + void son_spell_cast_success(Ref info); void son_death(); @@ -455,6 +456,9 @@ public: void cfinish_cast(); void cinterrupt_cast(); + void sspell_cast_success(Ref info); + void cspell_cast_success(Ref info); + //// Cooldowns //// Vector > *gets_cooldowns(); Vector > *getc_cooldowns();