mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-02-20 17:14:44 +01:00
Removed the Cooldown and the CategoryCooldown classes. Entity now stores these with a small internal struct. The notifications are not all perfect, but I'm going to rework them a bit in the next few commits, and they will be fixed then.
This commit is contained in:
parent
6a27714c5c
commit
fb3a5cde04
3
SCsub
3
SCsub
@ -89,9 +89,6 @@ sources = [
|
||||
|
||||
"utility/entity_create_info.cpp",
|
||||
|
||||
"utility/cooldown.cpp",
|
||||
"utility/category_cooldown.cpp",
|
||||
|
||||
"data/loot/loot_data_base.cpp",
|
||||
|
||||
"entities/ai/entity_ai.cpp",
|
||||
|
@ -641,22 +641,22 @@ void Aura::notification_sdeath(Ref<AuraData> data) {
|
||||
call("_notification_sdeath", data);
|
||||
}
|
||||
|
||||
void Aura::notification_scooldown_added(Ref<AuraData> data, Ref<Cooldown> cooldown) {
|
||||
void Aura::notification_scooldown_added(Ref<AuraData> data, int id, float value) {
|
||||
if (has_method("_notification_scooldown_added"))
|
||||
call("_notification_scooldown_added", data, cooldown);
|
||||
call("_notification_scooldown_added", data, id, value);
|
||||
}
|
||||
void Aura::notification_scooldown_removed(Ref<AuraData> data, Ref<Cooldown> cooldown) {
|
||||
void Aura::notification_scooldown_removed(Ref<AuraData> data, int id, float value) {
|
||||
if (has_method("_notification_scooldown_removed"))
|
||||
call("_notification_scooldown_removed", data, cooldown);
|
||||
call("_notification_scooldown_removed", data, id, value);
|
||||
}
|
||||
|
||||
void Aura::notification_scategory_cooldown_added(Ref<AuraData> data, Ref<CategoryCooldown> category_cooldown) {
|
||||
void Aura::notification_scategory_cooldown_added(Ref<AuraData> data, int id, float value) {
|
||||
if (has_method("_notification_scategory_cooldown_added"))
|
||||
call("_notification_scategory_cooldown_added", data, category_cooldown);
|
||||
call("_notification_scategory_cooldown_added", data, id, value);
|
||||
}
|
||||
void Aura::notification_scategory_cooldown_removed(Ref<AuraData> data, Ref<CategoryCooldown> category_cooldown) {
|
||||
void Aura::notification_scategory_cooldown_removed(Ref<AuraData> data, int id, float value) {
|
||||
if (has_method("_notification_scategory_cooldown_removed"))
|
||||
call("_notification_scategory_cooldown_removed", data, category_cooldown);
|
||||
call("_notification_scategory_cooldown_removed", data, id, value);
|
||||
}
|
||||
|
||||
void Aura::notification_sgcd_started(Ref<AuraData> data, float gcd) {
|
||||
@ -747,21 +747,21 @@ void Aura::notification_cdeath(Ref<AuraData> data) {
|
||||
call("_notification_cdeath", data);
|
||||
}
|
||||
|
||||
void Aura::notification_ccooldown_added(Ref<AuraData> data, Ref<Cooldown> cooldown) {
|
||||
void Aura::notification_ccooldown_added(Ref<AuraData> data, int id, float value) {
|
||||
if (has_method("_notification_ccooldown_added"))
|
||||
call("_notification_ccooldown_added", data, cooldown);
|
||||
call("_notification_ccooldown_added", data, id, value);
|
||||
}
|
||||
void Aura::notification_ccooldown_removed(Ref<AuraData> data, Ref<Cooldown> cooldown) {
|
||||
void Aura::notification_ccooldown_removed(Ref<AuraData> data, int id, float value) {
|
||||
if (has_method("_notification_ccooldown_removed"))
|
||||
call("_notification_ccooldown_removed", data, cooldown);
|
||||
call("_notification_ccooldown_removed", data, id, value);
|
||||
}
|
||||
void Aura::notification_ccategory_cooldown_added(Ref<AuraData> data, Ref<CategoryCooldown> category_cooldown) {
|
||||
void Aura::notification_ccategory_cooldown_added(Ref<AuraData> data, int id, float value) {
|
||||
if (has_method("_notification_ccategory_cooldown_added"))
|
||||
call("_notification_ccategory_cooldown_added", data, category_cooldown);
|
||||
call("_notification_ccategory_cooldown_added", data, id, value);
|
||||
}
|
||||
void Aura::notification_ccategory_cooldown_removed(Ref<AuraData> data, Ref<CategoryCooldown> category_cooldown) {
|
||||
void Aura::notification_ccategory_cooldown_removed(Ref<AuraData> data, int id, float value) {
|
||||
if (has_method("_notification_ccategory_cooldown_removed"))
|
||||
call("_notification_ccategory_cooldown_removed", data, category_cooldown);
|
||||
call("_notification_ccategory_cooldown_removed", data, id, value);
|
||||
}
|
||||
|
||||
void Aura::notification_cgcd_started(Ref<AuraData> data, float gcd) {
|
||||
|
@ -40,9 +40,6 @@ SOFTWARE.
|
||||
#include "../../pipelines/spell_damage_info.h"
|
||||
#include "../../pipelines/spell_heal_info.h"
|
||||
|
||||
#include "../../utility/category_cooldown.h"
|
||||
#include "../../utility/cooldown.h"
|
||||
|
||||
#include "../spells/spell_effect_visual.h"
|
||||
|
||||
class AuraApplyInfo;
|
||||
@ -267,11 +264,11 @@ public:
|
||||
|
||||
void notification_sdeath(Ref<AuraData> data);
|
||||
|
||||
void notification_scooldown_added(Ref<AuraData> data, Ref<Cooldown> cooldown);
|
||||
void notification_scooldown_removed(Ref<AuraData> data, Ref<Cooldown> cooldown);
|
||||
void notification_scooldown_added(Ref<AuraData> data, int id, float value);
|
||||
void notification_scooldown_removed(Ref<AuraData> data, int id, float value);
|
||||
|
||||
void notification_scategory_cooldown_added(Ref<AuraData> data, Ref<CategoryCooldown> category_cooldown);
|
||||
void notification_scategory_cooldown_removed(Ref<AuraData> data, Ref<CategoryCooldown> category_cooldown);
|
||||
void notification_scategory_cooldown_added(Ref<AuraData> data, int id, float value);
|
||||
void notification_scategory_cooldown_removed(Ref<AuraData> data, int id, float value);
|
||||
|
||||
void notification_sgcd_started(Ref<AuraData> data, float gcd);
|
||||
void notification_sgcd_finished(Ref<AuraData> data);
|
||||
@ -293,10 +290,10 @@ public:
|
||||
|
||||
void notification_cdeath(Ref<AuraData> data);
|
||||
|
||||
void notification_ccooldown_added(Ref<AuraData> data, Ref<Cooldown> cooldown);
|
||||
void notification_ccooldown_removed(Ref<AuraData> data, Ref<Cooldown> cooldown);
|
||||
void notification_ccategory_cooldown_added(Ref<AuraData> data, Ref<CategoryCooldown> category_cooldown);
|
||||
void notification_ccategory_cooldown_removed(Ref<AuraData> data, Ref<CategoryCooldown> category_cooldown);
|
||||
void notification_ccooldown_added(Ref<AuraData> data, int id, float value);
|
||||
void notification_ccooldown_removed(Ref<AuraData> data, int id, float value);
|
||||
void notification_ccategory_cooldown_added(Ref<AuraData> data, int id, float value);
|
||||
void notification_ccategory_cooldown_removed(Ref<AuraData> data, int id, float value);
|
||||
|
||||
void notification_cgcd_started(Ref<AuraData> data, float gcd);
|
||||
void notification_cgcd_finished(Ref<AuraData> data);
|
||||
|
@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="CategoryCooldown" inherits="Reference" version="3.2">
|
||||
<brief_description>
|
||||
Stores [Spell] category cooldown information during runtime.
|
||||
</brief_description>
|
||||
<description>
|
||||
These are usually interrupts in MMORPGS.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_from_dict" qualifiers="virtual">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="0" name="dict" type="Dictionary">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_to_dict" qualifiers="virtual">
|
||||
<return type="Dictionary">
|
||||
</return>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="from_dict">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="0" name="dict" type="Dictionary">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="to_dict">
|
||||
<return type="Dictionary">
|
||||
</return>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="update">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<argument index="0" name="delta" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="category_id" type="int" setter="set_category_id" getter="get_category_id" default="288">
|
||||
</member>
|
||||
<member name="remaining" type="float" setter="set_remaining" getter="get_remaining" default="0.0">
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
</constants>
|
||||
</class>
|
@ -1,56 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="Cooldown" inherits="Reference" version="3.2">
|
||||
<brief_description>
|
||||
Contains the runtime data for one of the [Cooldown]s of an [Entity].
|
||||
</brief_description>
|
||||
<description>
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_from_dict" qualifiers="virtual">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="0" name="dict" type="Dictionary">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_to_dict" qualifiers="virtual">
|
||||
<return type="Dictionary">
|
||||
</return>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="from_dict">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="0" name="dict" type="Dictionary">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="to_dict">
|
||||
<return type="Dictionary">
|
||||
</return>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="update">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<argument index="0" name="delta" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="remaining" type="float" setter="set_remaining" getter="get_remaining" default="0.0">
|
||||
</member>
|
||||
<member name="spell_id" type="int" setter="set_spell_id" getter="get_spell_id" default="0">
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
</constants>
|
||||
</class>
|
@ -413,22 +413,22 @@ void EntityClassData::notification_sdeath_bind(Node *entity) {
|
||||
notification_sdeath(e);
|
||||
}
|
||||
|
||||
void EntityClassData::notification_scooldown_added(Ref<Cooldown> cooldown) {
|
||||
void EntityClassData::notification_scooldown_added(int id, float value) {
|
||||
if (has_method("_notification_scooldown_added"))
|
||||
call("_notification_scooldown_added", cooldown);
|
||||
call("_notification_scooldown_added", id, value);
|
||||
}
|
||||
void EntityClassData::notification_scooldown_removed(Ref<Cooldown> cooldown) {
|
||||
void EntityClassData::notification_scooldown_removed(int id, float value) {
|
||||
if (has_method("_notification_scooldown_removed"))
|
||||
call("_notification_scooldown_removed", cooldown);
|
||||
call("_notification_scooldown_removed", id, value);
|
||||
}
|
||||
|
||||
void EntityClassData::notification_scategory_cooldown_added(Ref<CategoryCooldown> category_cooldown) {
|
||||
void EntityClassData::notification_scategory_cooldown_added(int id, float value) {
|
||||
if (has_method("_notification_scategory_cooldown_added"))
|
||||
call("_notification_scategory_cooldown_added", category_cooldown);
|
||||
call("_notification_scategory_cooldown_added", id, value);
|
||||
}
|
||||
void EntityClassData::notification_scategory_cooldown_removed(Ref<CategoryCooldown> category_cooldown) {
|
||||
void EntityClassData::notification_scategory_cooldown_removed(int id, float value) {
|
||||
if (has_method("_notification_scategory_cooldown_removed"))
|
||||
call("_notification_scategory_cooldown_removed", category_cooldown);
|
||||
call("_notification_scategory_cooldown_removed", id, value);
|
||||
}
|
||||
|
||||
void EntityClassData::notification_sgcd_started(Entity *entity, float gcd) {
|
||||
@ -553,29 +553,21 @@ void EntityClassData::notification_cdeath_bind(Node *entity) {
|
||||
notification_cdeath(e);
|
||||
}
|
||||
|
||||
void EntityClassData::notification_ccooldown_added(Ref<Cooldown> cooldown) {
|
||||
ERR_FAIL_COND(!cooldown.is_valid());
|
||||
|
||||
void EntityClassData::notification_ccooldown_added(int id, float value) {
|
||||
if (has_method("_notification_ccooldown_added"))
|
||||
call("_notification_ccooldown_added", cooldown);
|
||||
call("_notification_ccooldown_added", id, value);
|
||||
}
|
||||
void EntityClassData::notification_ccooldown_removed(Ref<Cooldown> cooldown) {
|
||||
ERR_FAIL_COND(!cooldown.is_valid());
|
||||
|
||||
void EntityClassData::notification_ccooldown_removed(int id, float value) {
|
||||
if (has_method("_notification_ccooldown_removed"))
|
||||
call("_notification_ccooldown_removed", cooldown);
|
||||
call("_notification_ccooldown_removed", id, value);
|
||||
}
|
||||
void EntityClassData::notification_ccategory_cooldown_added(Ref<CategoryCooldown> category_cooldown) {
|
||||
ERR_FAIL_COND(!category_cooldown.is_valid());
|
||||
|
||||
void EntityClassData::notification_ccategory_cooldown_added(int id, float value) {
|
||||
if (has_method("_notification_ccategory_cooldown_added"))
|
||||
call("_notification_ccategory_cooldown_added", category_cooldown);
|
||||
call("_notification_ccategory_cooldown_added", id, value);
|
||||
}
|
||||
void EntityClassData::notification_ccategory_cooldown_removed(Ref<CategoryCooldown> category_cooldown) {
|
||||
ERR_FAIL_COND(!category_cooldown.is_valid());
|
||||
|
||||
void EntityClassData::notification_ccategory_cooldown_removed(int id, float value) {
|
||||
if (has_method("_notification_ccategory_cooldown_removed"))
|
||||
call("_notification_ccategory_cooldown_removed", category_cooldown);
|
||||
call("_notification_ccategory_cooldown_removed", id, value);
|
||||
}
|
||||
|
||||
void EntityClassData::notification_cgcd_started(Entity *entity, float gcd) {
|
||||
|
@ -37,8 +37,6 @@ SOFTWARE.
|
||||
#include "../../pipelines/spell_heal_info.h"
|
||||
|
||||
#include "../../item_enums.h"
|
||||
#include "../../utility/category_cooldown.h"
|
||||
#include "../../utility/cooldown.h"
|
||||
|
||||
#include "../resources/entity_resource_data.h"
|
||||
|
||||
@ -152,11 +150,11 @@ public:
|
||||
void notification_sdeath(Entity *entity);
|
||||
void notification_sdeath_bind(Node *entity);
|
||||
|
||||
void notification_scooldown_added(Ref<Cooldown> cooldown);
|
||||
void notification_scooldown_removed(Ref<Cooldown> cooldown);
|
||||
void notification_scooldown_added(int id, float value);
|
||||
void notification_scooldown_removed(int id, float value);
|
||||
|
||||
void notification_scategory_cooldown_added(Ref<CategoryCooldown> category_cooldown);
|
||||
void notification_scategory_cooldown_removed(Ref<CategoryCooldown> category_cooldown);
|
||||
void notification_scategory_cooldown_added(int id, float value);
|
||||
void notification_scategory_cooldown_removed(int id, float value);
|
||||
|
||||
void notification_sgcd_started(Entity *entity, float gcd);
|
||||
void notification_sgcd_finished(Entity *entity);
|
||||
@ -182,10 +180,10 @@ public:
|
||||
void notification_cdeath(Entity *entity);
|
||||
void notification_cdeath_bind(Node *entity);
|
||||
|
||||
void notification_ccooldown_added(Ref<Cooldown> cooldown);
|
||||
void notification_ccooldown_removed(Ref<Cooldown> cooldown);
|
||||
void notification_ccategory_cooldown_added(Ref<CategoryCooldown> category_cooldown);
|
||||
void notification_ccategory_cooldown_removed(Ref<CategoryCooldown> category_cooldown);
|
||||
void notification_ccooldown_added(int id, float value);
|
||||
void notification_ccooldown_removed(int id, float value);
|
||||
void notification_ccategory_cooldown_added(int id, float value);
|
||||
void notification_ccategory_cooldown_removed(int id, float value);
|
||||
|
||||
void notification_cgcd_started(Entity *entity, float gcd);
|
||||
void notification_cgcd_finished(Entity *entity);
|
||||
|
@ -390,34 +390,34 @@ void EntityData::notification_sdeath_bind(Node *entity) {
|
||||
notification_sdeath(e);
|
||||
}
|
||||
|
||||
void EntityData::notification_scooldown_added(Ref<Cooldown> cooldown) {
|
||||
if (_entity_class_data.is_valid())
|
||||
_entity_class_data->notification_scooldown_added(cooldown);
|
||||
void EntityData::notification_scooldown_added(int id, float value) {
|
||||
//if (_entity_class_data.is_valid())
|
||||
// _entity_class_data->notification_scooldown_added(id, value);
|
||||
|
||||
if (has_method("_notification_scooldown_added"))
|
||||
call("_notification_scooldown_added", cooldown);
|
||||
call("_notification_scooldown_added", id, value);
|
||||
}
|
||||
void EntityData::notification_scooldown_removed(Ref<Cooldown> cooldown) {
|
||||
if (_entity_class_data.is_valid())
|
||||
_entity_class_data->notification_scooldown_removed(cooldown);
|
||||
void EntityData::notification_scooldown_removed(int id, float value) {
|
||||
//if (_entity_class_data.is_valid())
|
||||
// _entity_class_data->notification_scooldown_removed(id, value);
|
||||
|
||||
if (has_method("_notification_scooldown_removed"))
|
||||
call("_notification_scooldown_removed", cooldown);
|
||||
call("_notification_scooldown_removed", id, value);
|
||||
}
|
||||
|
||||
void EntityData::notification_scategory_cooldown_added(Ref<CategoryCooldown> category_cooldown) {
|
||||
if (_entity_class_data.is_valid())
|
||||
_entity_class_data->notification_scategory_cooldown_added(category_cooldown);
|
||||
void EntityData::notification_scategory_cooldown_added(int id, float value) {
|
||||
//if (_entity_class_data.is_valid())
|
||||
// _entity_class_data->notification_scategory_cooldown_added(id, value);
|
||||
|
||||
if (has_method("_notification_scategory_cooldown_added"))
|
||||
call("_notification_scategory_cooldown_added", category_cooldown);
|
||||
call("_notification_scategory_cooldown_added", id, value);
|
||||
}
|
||||
void EntityData::notification_scategory_cooldown_removed(Ref<CategoryCooldown> category_cooldown) {
|
||||
if (_entity_class_data.is_valid())
|
||||
_entity_class_data->notification_scategory_cooldown_removed(category_cooldown);
|
||||
void EntityData::notification_scategory_cooldown_removed(int id, float value) {
|
||||
//if (_entity_class_data.is_valid())
|
||||
// _entity_class_data->notification_scategory_cooldown_removed(id, value);
|
||||
|
||||
if (has_method("_notification_scategory_cooldown_removed"))
|
||||
call("_notification_scategory_cooldown_removed", category_cooldown);
|
||||
call("_notification_scategory_cooldown_removed", id, value);
|
||||
}
|
||||
|
||||
void EntityData::notification_sgcd_started(Entity *entity, float gcd) {
|
||||
@ -579,41 +579,33 @@ void EntityData::notification_cdeath_bind(Node *entity) {
|
||||
notification_cdeath(e);
|
||||
}
|
||||
|
||||
void EntityData::notification_ccooldown_added(Ref<Cooldown> cooldown) {
|
||||
ERR_FAIL_COND(!cooldown.is_valid());
|
||||
|
||||
void EntityData::notification_ccooldown_added(int id, float value) {
|
||||
if (_entity_class_data.is_valid())
|
||||
_entity_class_data->notification_ccooldown_added(cooldown);
|
||||
_entity_class_data->notification_ccooldown_added(id, value);
|
||||
|
||||
if (has_method("_notification_ccooldown_added"))
|
||||
call("_notification_ccooldown_added", cooldown);
|
||||
call("_notification_ccooldown_added", id, value);
|
||||
}
|
||||
void EntityData::notification_ccooldown_removed(Ref<Cooldown> cooldown) {
|
||||
ERR_FAIL_COND(!cooldown.is_valid());
|
||||
|
||||
void EntityData::notification_ccooldown_removed(int id, float value) {
|
||||
if (_entity_class_data.is_valid())
|
||||
_entity_class_data->notification_ccooldown_removed(cooldown);
|
||||
_entity_class_data->notification_ccooldown_removed(id, value);
|
||||
|
||||
if (has_method("_notification_ccooldown_removed"))
|
||||
call("_notification_ccooldown_removed", cooldown);
|
||||
call("_notification_ccooldown_removed", id, value);
|
||||
}
|
||||
void EntityData::notification_ccategory_cooldown_added(Ref<CategoryCooldown> category_cooldown) {
|
||||
ERR_FAIL_COND(!category_cooldown.is_valid());
|
||||
|
||||
void EntityData::notification_ccategory_cooldown_added(int id, float value) {
|
||||
if (_entity_class_data.is_valid())
|
||||
_entity_class_data->notification_ccategory_cooldown_added(category_cooldown);
|
||||
_entity_class_data->notification_ccategory_cooldown_added(id, value);
|
||||
|
||||
if (has_method("_notification_ccategory_cooldown_added"))
|
||||
call("_notification_ccategory_cooldown_added", category_cooldown);
|
||||
call("_notification_ccategory_cooldown_added", id, value);
|
||||
}
|
||||
void EntityData::notification_ccategory_cooldown_removed(Ref<CategoryCooldown> category_cooldown) {
|
||||
ERR_FAIL_COND(!category_cooldown.is_valid());
|
||||
|
||||
void EntityData::notification_ccategory_cooldown_removed(int id, float value) {
|
||||
if (_entity_class_data.is_valid())
|
||||
_entity_class_data->notification_ccategory_cooldown_removed(category_cooldown);
|
||||
_entity_class_data->notification_ccategory_cooldown_removed(id, value);
|
||||
|
||||
if (has_method("_notification_ccategory_cooldown_removed"))
|
||||
call("_notification_ccategory_cooldown_removed", category_cooldown);
|
||||
call("_notification_ccategory_cooldown_removed", id, value);
|
||||
}
|
||||
|
||||
void EntityData::notification_cgcd_started(Entity *entity, float gcd) {
|
||||
|
@ -35,9 +35,6 @@ SOFTWARE.
|
||||
#include "../../pipelines/spell_damage_info.h"
|
||||
#include "../../pipelines/spell_heal_info.h"
|
||||
|
||||
#include "../../utility/category_cooldown.h"
|
||||
#include "../../utility/cooldown.h"
|
||||
|
||||
#include "../../data/loot/loot_data_base.h"
|
||||
|
||||
#include "entity_class_data.h"
|
||||
@ -162,11 +159,11 @@ public:
|
||||
void notification_sdeath(Entity *entity);
|
||||
void notification_sdeath_bind(Node *entity);
|
||||
|
||||
void notification_scooldown_added(Ref<Cooldown> cooldown);
|
||||
void notification_scooldown_removed(Ref<Cooldown> cooldown);
|
||||
void notification_scooldown_added(int id, float value);
|
||||
void notification_scooldown_removed(int id, float value);
|
||||
|
||||
void notification_scategory_cooldown_added(Ref<CategoryCooldown> category_cooldown);
|
||||
void notification_scategory_cooldown_removed(Ref<CategoryCooldown> category_cooldown);
|
||||
void notification_scategory_cooldown_added(int id, float value);
|
||||
void notification_scategory_cooldown_removed(int id, float value);
|
||||
|
||||
void notification_sgcd_started(Entity *entity, float gcd);
|
||||
void notification_sgcd_finished(Entity *entity);
|
||||
@ -189,10 +186,10 @@ public:
|
||||
void notification_ccast(int what, Ref<SpellCastInfo> info);
|
||||
void notification_cdamage(int what, Ref<SpellDamageInfo> info);
|
||||
|
||||
void notification_ccooldown_added(Ref<Cooldown> cooldown);
|
||||
void notification_ccooldown_removed(Ref<Cooldown> cooldown);
|
||||
void notification_ccategory_cooldown_added(Ref<CategoryCooldown> category_cooldown);
|
||||
void notification_ccategory_cooldown_removed(Ref<CategoryCooldown> category_cooldown);
|
||||
void notification_ccooldown_added(int id, float value);
|
||||
void notification_ccooldown_removed(int id, float value);
|
||||
void notification_ccategory_cooldown_added(int id, float value);
|
||||
void notification_ccategory_cooldown_removed(int id, float value);
|
||||
|
||||
void notification_cdeath(Entity *entity);
|
||||
void notification_cdeath_bind(Node *entity);
|
||||
|
@ -1130,7 +1130,12 @@ Dictionary Entity::_to_dict() {
|
||||
Dictionary cds;
|
||||
|
||||
for (int i = 0; i < _s_cooldowns.size(); ++i) {
|
||||
cds[i] = _s_cooldowns.get(i)->to_dict();
|
||||
Dictionary cdict;
|
||||
|
||||
cdict["path"] = ESS::get_singleton()->get_resource_db()->spell_id_to_path(_s_cooldowns[i].id);
|
||||
cdict["remaining"] = _s_cooldowns[i].cooldown;
|
||||
|
||||
cds[i] = cdict;
|
||||
}
|
||||
|
||||
dict["cooldowns"] = cds;
|
||||
@ -1138,7 +1143,12 @@ Dictionary Entity::_to_dict() {
|
||||
Dictionary ccds;
|
||||
|
||||
for (int i = 0; i < _s_category_cooldowns.size(); ++i) {
|
||||
ccds[i] = _s_category_cooldowns.get(i)->to_dict();
|
||||
Dictionary ccdict;
|
||||
|
||||
ccdict["path"] = ESS::get_singleton()->get_resource_db()->spell_id_to_path(_s_category_cooldowns[i].id);
|
||||
ccdict["remaining"] = _s_category_cooldowns[i].cooldown;
|
||||
|
||||
ccds[i] = ccdict;
|
||||
}
|
||||
|
||||
dict["category_cooldowns"] = ccds;
|
||||
@ -1354,10 +1364,13 @@ void Entity::_from_dict(const Dictionary &dict) {
|
||||
Dictionary cds = dict.get("cooldowns", Dictionary());
|
||||
|
||||
for (int i = 0; i < cds.size(); ++i) {
|
||||
Ref<Cooldown> cd;
|
||||
cd.instance();
|
||||
Dictionary cddict = cds.get(String::num(i), Dictionary());
|
||||
|
||||
cd->from_dict(cds.get(String::num(i), Dictionary()));
|
||||
Cooldown cd;
|
||||
|
||||
cd.path = dict.get("path", "");
|
||||
cd.id = ESS::get_singleton()->get_resource_db()->spell_path_to_id(cd.path);
|
||||
cd.cooldown = dict.get("remaining", 0);
|
||||
|
||||
_s_cooldowns.push_back(cd);
|
||||
_c_cooldowns.push_back(cd);
|
||||
@ -1366,10 +1379,13 @@ void Entity::_from_dict(const Dictionary &dict) {
|
||||
Dictionary ccds = dict.get("category_cooldowns", Dictionary());
|
||||
|
||||
for (int i = 0; i < ccds.size(); ++i) {
|
||||
Ref<CategoryCooldown> ccd;
|
||||
ccd.instance();
|
||||
Dictionary ccdict = ccds.get(String::num(i), Dictionary());
|
||||
|
||||
ccd->from_dict(ccds.get(String::num(i), Dictionary()));
|
||||
Cooldown ccd;
|
||||
|
||||
ccd.path = dict.get("path", "");
|
||||
ccd.id = ESS::get_singleton()->get_resource_db()->spell_path_to_id(ccd.path);
|
||||
ccd.cooldown = dict.get("remaining", 0);
|
||||
|
||||
_s_category_cooldowns.push_back(ccd);
|
||||
_c_category_cooldowns.push_back(ccd);
|
||||
@ -2937,70 +2953,70 @@ void Entity::notification_sdeath() {
|
||||
call("_notification_sdeath");
|
||||
}
|
||||
|
||||
void Entity::notification_scooldown_added(Ref<Cooldown> cooldown) {
|
||||
ERR_FAIL_COND(!cooldown.is_valid());
|
||||
|
||||
void Entity::notification_scooldown_added(int id, float value) {
|
||||
if (_s_entity_data.is_valid()) {
|
||||
_s_entity_data->notification_scooldown_added(cooldown);
|
||||
_s_entity_data->notification_scooldown_added(id, value);
|
||||
}
|
||||
|
||||
if (has_method("_notification_scooldown_added"))
|
||||
call("_notification_scooldown_added", cooldown);
|
||||
call("_notification_scooldown_added", id, value);
|
||||
|
||||
for (int i = 0; i < _s_auras.size(); ++i) {
|
||||
Ref<AuraData> ad = _s_auras.get(i);
|
||||
|
||||
ad->get_aura()->notification_scooldown_added(ad, cooldown);
|
||||
ad->get_aura()->notification_scooldown_added(ad, id, value);
|
||||
}
|
||||
}
|
||||
void Entity::notification_scooldown_removed(Ref<Cooldown> cooldown) {
|
||||
ERR_FAIL_COND(!cooldown.is_valid());
|
||||
|
||||
emit_signal("scooldown_added", id, value);
|
||||
}
|
||||
void Entity::notification_scooldown_removed(int id, float value) {
|
||||
if (_s_entity_data.is_valid()) {
|
||||
_s_entity_data->notification_scooldown_removed(cooldown);
|
||||
_s_entity_data->notification_scooldown_removed(id, value);
|
||||
}
|
||||
|
||||
if (has_method("_notification_scooldown_removed"))
|
||||
call("_notification_scooldown_removed", cooldown);
|
||||
call("_notification_scooldown_removed", id);
|
||||
|
||||
for (int i = 0; i < _s_auras.size(); ++i) {
|
||||
Ref<AuraData> ad = _s_auras.get(i);
|
||||
|
||||
ad->get_aura()->notification_scooldown_removed(ad, cooldown);
|
||||
ad->get_aura()->notification_scooldown_removed(ad, id, value);
|
||||
}
|
||||
|
||||
emit_signal("scooldown_removed", id, value);
|
||||
}
|
||||
|
||||
void Entity::notification_scategory_cooldown_added(Ref<CategoryCooldown> category_cooldown) {
|
||||
ERR_FAIL_COND(!category_cooldown.is_valid());
|
||||
|
||||
void Entity::notification_scategory_cooldown_added(int id, float value) {
|
||||
if (_s_entity_data.is_valid()) {
|
||||
_s_entity_data->notification_scategory_cooldown_added(category_cooldown);
|
||||
_s_entity_data->notification_scategory_cooldown_added(id, value);
|
||||
}
|
||||
|
||||
if (has_method("_notification_scategory_cooldown_added"))
|
||||
call("_notification_scategory_cooldown_added", category_cooldown);
|
||||
call("_notification_scategory_cooldown_added", id, value);
|
||||
|
||||
for (int i = 0; i < _s_auras.size(); ++i) {
|
||||
Ref<AuraData> ad = _s_auras.get(i);
|
||||
|
||||
ad->get_aura()->notification_scategory_cooldown_added(ad, category_cooldown);
|
||||
ad->get_aura()->notification_scategory_cooldown_added(ad, id, value);
|
||||
}
|
||||
}
|
||||
void Entity::notification_scategory_cooldown_removed(Ref<CategoryCooldown> category_cooldown) {
|
||||
ERR_FAIL_COND(!category_cooldown.is_valid());
|
||||
|
||||
emit_signal("scategory_cooldown_added", id, value);
|
||||
}
|
||||
void Entity::notification_scategory_cooldown_removed(int id, float value) {
|
||||
if (_s_entity_data.is_valid()) {
|
||||
_s_entity_data->notification_scategory_cooldown_removed(category_cooldown);
|
||||
_s_entity_data->notification_scategory_cooldown_removed(id, value);
|
||||
}
|
||||
|
||||
if (has_method("_notification_scategory_cooldown_removed"))
|
||||
call("_notification_scategory_cooldown_removed", category_cooldown);
|
||||
call("_notification_scategory_cooldown_removed", id, value);
|
||||
|
||||
for (int i = 0; i < _s_auras.size(); ++i) {
|
||||
Ref<AuraData> ad = _s_auras.get(i);
|
||||
|
||||
ad->get_aura()->notification_scategory_cooldown_removed(ad, category_cooldown);
|
||||
ad->get_aura()->notification_scategory_cooldown_removed(ad, id, value);
|
||||
}
|
||||
|
||||
emit_signal("scategory_cooldown_removed", id, value);
|
||||
}
|
||||
|
||||
void Entity::notification_sgcd_started() {
|
||||
@ -3615,69 +3631,69 @@ void Entity::notification_cdeath() {
|
||||
call("_notification_cdeath");
|
||||
}
|
||||
|
||||
void Entity::notification_ccooldown_added(Ref<Cooldown> cooldown) {
|
||||
ERR_FAIL_COND(!cooldown.is_valid());
|
||||
|
||||
void Entity::notification_ccooldown_added(int id, float value) {
|
||||
if (_c_entity_data.is_valid()) {
|
||||
_c_entity_data->notification_ccooldown_added(cooldown);
|
||||
_c_entity_data->notification_ccooldown_added(id, value);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _c_auras.size(); ++i) {
|
||||
Ref<AuraData> ad = _c_auras.get(i);
|
||||
|
||||
ad->get_aura()->notification_ccooldown_added(ad, cooldown);
|
||||
ad->get_aura()->notification_ccooldown_added(ad, id, value);
|
||||
}
|
||||
|
||||
if (has_method("_notification_ccooldown_added"))
|
||||
call("_notification_ccooldown_added", cooldown);
|
||||
}
|
||||
void Entity::notification_ccooldown_removed(Ref<Cooldown> cooldown) {
|
||||
ERR_FAIL_COND(!cooldown.is_valid());
|
||||
call("_notification_ccooldown_added", id, value);
|
||||
|
||||
emit_signal("ccooldown_added", id, value);
|
||||
}
|
||||
void Entity::notification_ccooldown_removed(int id, float value) {
|
||||
if (_c_entity_data.is_valid()) {
|
||||
_c_entity_data->notification_ccooldown_removed(cooldown);
|
||||
_c_entity_data->notification_ccooldown_removed(id, value);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _c_auras.size(); ++i) {
|
||||
Ref<AuraData> ad = _c_auras.get(i);
|
||||
|
||||
ad->get_aura()->notification_ccooldown_removed(ad, cooldown);
|
||||
ad->get_aura()->notification_ccooldown_removed(ad, id, value);
|
||||
}
|
||||
|
||||
if (has_method("_notification_ccooldown_removed"))
|
||||
call("_notification_ccooldown_removed", cooldown);
|
||||
}
|
||||
void Entity::notification_ccategory_cooldown_added(Ref<CategoryCooldown> category_cooldown) {
|
||||
ERR_FAIL_COND(!category_cooldown.is_valid());
|
||||
call("_notification_ccooldown_removed", id, value);
|
||||
|
||||
emit_signal("ccooldown_removed", id, value);
|
||||
}
|
||||
void Entity::notification_ccategory_cooldown_added(int id, float value) {
|
||||
if (_c_entity_data.is_valid()) {
|
||||
_c_entity_data->notification_ccategory_cooldown_added(category_cooldown);
|
||||
_c_entity_data->notification_ccategory_cooldown_added(id, value);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _c_auras.size(); ++i) {
|
||||
Ref<AuraData> ad = _c_auras.get(i);
|
||||
|
||||
ad->get_aura()->notification_ccategory_cooldown_added(ad, category_cooldown);
|
||||
ad->get_aura()->notification_ccategory_cooldown_added(ad, id, value);
|
||||
}
|
||||
|
||||
if (has_method("_notification_ccategory_cooldown_added"))
|
||||
call("_notification_ccategory_cooldown_added", category_cooldown);
|
||||
}
|
||||
void Entity::notification_ccategory_cooldown_removed(Ref<CategoryCooldown> category_cooldown) {
|
||||
ERR_FAIL_COND(!category_cooldown.is_valid());
|
||||
call("_notification_ccategory_cooldown_added", id, value);
|
||||
|
||||
emit_signal("ccategory_cooldown_added", id, value);
|
||||
}
|
||||
void Entity::notification_ccategory_cooldown_removed(int id, float value) {
|
||||
if (_c_entity_data.is_valid()) {
|
||||
_c_entity_data->notification_ccategory_cooldown_removed(category_cooldown);
|
||||
_c_entity_data->notification_ccategory_cooldown_removed(id, value);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _c_auras.size(); ++i) {
|
||||
Ref<AuraData> ad = _c_auras.get(i);
|
||||
|
||||
ad->get_aura()->notification_ccategory_cooldown_removed(ad, category_cooldown);
|
||||
ad->get_aura()->notification_ccategory_cooldown_removed(ad, id, value);
|
||||
}
|
||||
|
||||
if (has_method("_notification_ccategory_cooldown_removed"))
|
||||
call("_notification_ccategory_cooldown_removed", category_cooldown);
|
||||
call("_notification_ccategory_cooldown_removed", id, value);
|
||||
|
||||
emit_signal("ccategory_cooldown_removed", id, value);
|
||||
}
|
||||
|
||||
void Entity::notification_cxp_gained(int value) {
|
||||
@ -3874,166 +3890,133 @@ void Entity::cast_spell_successc(Ref<SpellCastInfo> info) {
|
||||
}
|
||||
|
||||
//// Cooldowns ////
|
||||
Vector<Ref<Cooldown> > *Entity::cooldowns_gets() {
|
||||
return &_s_cooldowns;
|
||||
}
|
||||
Vector<Ref<Cooldown> > *Entity::cooldowns_getc() {
|
||||
return &_c_cooldowns;
|
||||
}
|
||||
|
||||
HashMap<int, Ref<Cooldown> > *Entity::cooldown_get_maps() {
|
||||
return &_s_cooldown_map;
|
||||
}
|
||||
HashMap<int, Ref<Cooldown> > *Entity::cooldown_get_mapc() {
|
||||
return &_c_cooldown_map;
|
||||
}
|
||||
|
||||
bool Entity::cooldown_hass(int spell_id) {
|
||||
return _s_cooldown_map.has(spell_id);
|
||||
}
|
||||
void Entity::cooldown_adds(int spell_id, float value) {
|
||||
if (_s_cooldown_map.has(spell_id)) {
|
||||
Ref<Cooldown> cd = _s_cooldown_map.get(spell_id);
|
||||
|
||||
cd->set_remaining(value);
|
||||
|
||||
notification_scooldown_added(cd);
|
||||
|
||||
emit_signal("scooldown_added", cd);
|
||||
|
||||
ORPC(cooldown_addc, spell_id, value);
|
||||
|
||||
return;
|
||||
for (int i = 0; i < _s_cooldowns.size(); ++i) {
|
||||
if (_s_cooldowns[i].id == spell_id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Cooldown> cd;
|
||||
cd.instance();
|
||||
return false;
|
||||
}
|
||||
void Entity::cooldown_adds(int spell_id, float value) {
|
||||
for (int i = 0; i < _s_cooldowns.size(); ++i) {
|
||||
if (_s_cooldowns[i].id == spell_id) {
|
||||
_s_cooldowns.write[i].cooldown = value;
|
||||
|
||||
cd->set_spell_id(spell_id);
|
||||
cd->set_remaining(value);
|
||||
notification_scooldown_added(spell_id, value);
|
||||
|
||||
ORPC(cooldown_addc, spell_id, value);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Cooldown cd;
|
||||
cd.id = spell_id;
|
||||
cd.cooldown = value;
|
||||
|
||||
_s_cooldown_map.set(spell_id, cd);
|
||||
_s_cooldowns.push_back(cd);
|
||||
|
||||
notification_scooldown_added(cd);
|
||||
|
||||
emit_signal("scooldown_added", cd);
|
||||
notification_scooldown_added(spell_id, value);
|
||||
|
||||
ORPC(cooldown_addc, spell_id, value);
|
||||
}
|
||||
void Entity::cooldown_removes(int spell_id) {
|
||||
Ref<Cooldown> cd;
|
||||
|
||||
if (_s_cooldown_map.has(spell_id)) {
|
||||
_s_cooldown_map.erase(spell_id);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _s_cooldowns.size(); ++i) {
|
||||
if (_s_cooldowns.get(i)->get_spell_id() == spell_id) {
|
||||
cd = _s_cooldowns.get(i);
|
||||
if (_s_cooldowns[i].id == spell_id) {
|
||||
float cd = _s_cooldowns[i].cooldown;
|
||||
|
||||
_s_cooldowns.remove(i);
|
||||
|
||||
break;
|
||||
notification_scooldown_removed(spell_id, cd);
|
||||
|
||||
ORPC(cooldown_removec, spell_id);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float Entity::cooldown_gets(int spell_id) {
|
||||
for (int i = 0; i < _s_cooldowns.size(); ++i) {
|
||||
if (_s_cooldowns[i].id == spell_id) {
|
||||
return _s_cooldowns[i].cooldown;
|
||||
}
|
||||
}
|
||||
|
||||
notification_scooldown_removed(cd);
|
||||
|
||||
emit_signal("scooldown_removed", cd);
|
||||
|
||||
ORPC(cooldown_removec, spell_id);
|
||||
return 0;
|
||||
}
|
||||
Ref<Cooldown> Entity::cooldown_gets(int spell_id) {
|
||||
if (!_s_cooldown_map.has(spell_id)) {
|
||||
return Ref<Cooldown>();
|
||||
}
|
||||
float Entity::cooldown_gets_index(int index) {
|
||||
ERR_FAIL_INDEX_V(index, _s_cooldowns.size(), 0);
|
||||
|
||||
return _s_cooldown_map.get(spell_id);
|
||||
}
|
||||
Ref<Cooldown> Entity::cooldown_gets_index(int index) {
|
||||
ERR_FAIL_INDEX_V(index, _s_cooldowns.size(), Ref<Cooldown>());
|
||||
|
||||
return _s_cooldowns.get(index);
|
||||
return _s_cooldowns[index].cooldown;
|
||||
}
|
||||
int Entity::cooldown_gets_count() {
|
||||
return _s_cooldowns.size();
|
||||
}
|
||||
|
||||
bool Entity::cooldown_hasc(int spell_id) {
|
||||
return _c_cooldown_map.has(spell_id);
|
||||
}
|
||||
void Entity::cooldown_addc(int spell_id, float value) {
|
||||
if (_c_cooldown_map.has(spell_id)) {
|
||||
Ref<Cooldown> cd = _c_cooldown_map.get(spell_id);
|
||||
|
||||
cd->set_remaining(value);
|
||||
|
||||
notification_ccooldown_added(cd);
|
||||
|
||||
emit_signal("ccooldown_added", cd);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<Cooldown> cd;
|
||||
cd.instance();
|
||||
|
||||
cd->set_spell_id(spell_id);
|
||||
cd->set_remaining(value);
|
||||
|
||||
_c_cooldown_map.set(spell_id, cd);
|
||||
_c_cooldowns.push_back(cd);
|
||||
|
||||
notification_ccooldown_added(cd);
|
||||
|
||||
emit_signal("ccooldown_added", cd);
|
||||
}
|
||||
void Entity::cooldown_removec(int spell_id) {
|
||||
Ref<Cooldown> cd;
|
||||
|
||||
if (_c_cooldown_map.has(spell_id)) {
|
||||
_c_cooldown_map.erase(spell_id);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _c_cooldowns.size(); ++i) {
|
||||
if (_c_cooldowns.get(i)->get_spell_id() == spell_id) {
|
||||
cd = _c_cooldowns.get(i);
|
||||
_c_cooldowns.remove(i);
|
||||
break;
|
||||
if (_c_cooldowns[i].id == spell_id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!cd.is_valid())
|
||||
cd.instance();
|
||||
|
||||
notification_ccooldown_removed(cd);
|
||||
|
||||
emit_signal("ccooldown_removed", cd);
|
||||
return false;
|
||||
}
|
||||
Ref<Cooldown> Entity::cooldown_getc(int spell_id) {
|
||||
if (!_c_cooldown_map.has(spell_id)) {
|
||||
return Ref<Cooldown>();
|
||||
void Entity::cooldown_addc(int spell_id, float value) {
|
||||
for (int i = 0; i < _c_cooldowns.size(); ++i) {
|
||||
if (_c_cooldowns[i].id == spell_id) {
|
||||
_c_cooldowns.write[i].cooldown = value;
|
||||
|
||||
notification_ccooldown_added(spell_id, value);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return _c_cooldown_map.get(spell_id);
|
||||
}
|
||||
Ref<Cooldown> Entity::cooldown_getc_index(int index) {
|
||||
ERR_FAIL_INDEX_V(index, _c_cooldowns.size(), Ref<Cooldown>());
|
||||
Cooldown cd;
|
||||
cd.id = spell_id;
|
||||
cd.cooldown = value;
|
||||
|
||||
return _c_cooldowns.get(index);
|
||||
_c_cooldowns.push_back(cd);
|
||||
|
||||
notification_ccooldown_added(spell_id, value);
|
||||
}
|
||||
void Entity::cooldown_removec(int spell_id) {
|
||||
for (int i = 0; i < _c_cooldowns.size(); ++i) {
|
||||
if (_c_cooldowns[i].id == spell_id) {
|
||||
float cd = _c_cooldowns[i].cooldown;
|
||||
|
||||
_c_cooldowns.remove(i);
|
||||
|
||||
notification_ccooldown_removed(spell_id, cd);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
float Entity::cooldown_getc(int spell_id) {
|
||||
for (int i = 0; i < _c_cooldowns.size(); ++i) {
|
||||
if (_c_cooldowns[i].id == spell_id) {
|
||||
return _c_cooldowns[i].cooldown;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
float Entity::cooldown_getc_index(int index) {
|
||||
ERR_FAIL_INDEX_V(index, _c_cooldowns.size(), 0);
|
||||
|
||||
return _c_cooldowns[index].cooldown;
|
||||
}
|
||||
int Entity::cooldown_getc_count() {
|
||||
return _c_cooldowns.size();
|
||||
}
|
||||
|
||||
//Category Cooldowns
|
||||
Vector<Ref<CategoryCooldown> > Entity::category_cooldowns_gets() {
|
||||
return _s_category_cooldowns;
|
||||
}
|
||||
Vector<Ref<CategoryCooldown> > Entity::category_cooldowns_getc() {
|
||||
return _c_category_cooldowns;
|
||||
}
|
||||
|
||||
bool Entity::category_cooldown_hass(int category_id) {
|
||||
return (category_id & _s_active_category_cooldowns) > 0;
|
||||
@ -4041,14 +4024,10 @@ bool Entity::category_cooldown_hass(int category_id) {
|
||||
void Entity::category_cooldown_adds(int category_id, float value) {
|
||||
if ((category_id & _s_active_category_cooldowns)) {
|
||||
for (int i = 0; i < _s_category_cooldowns.size(); ++i) {
|
||||
Ref<CategoryCooldown> cc = _s_category_cooldowns.get(i);
|
||||
if (_s_category_cooldowns[i].id == category_id) {
|
||||
_s_category_cooldowns.write[i].cooldown = value;
|
||||
|
||||
if (cc->get_category_id() == category_id) {
|
||||
cc->set_remaining(value);
|
||||
|
||||
notification_scategory_cooldown_added(cc);
|
||||
|
||||
emit_signal("scategory_cooldown_added", cc);
|
||||
notification_scategory_cooldown_added(category_id, value);
|
||||
|
||||
ORPC(category_cooldown_addc, category_id, value);
|
||||
|
||||
@ -4057,63 +4036,55 @@ void Entity::category_cooldown_adds(int category_id, float value) {
|
||||
}
|
||||
}
|
||||
|
||||
Ref<CategoryCooldown> cc;
|
||||
cc.instance();
|
||||
|
||||
cc->set_category_id(category_id);
|
||||
cc->set_remaining(value);
|
||||
|
||||
_s_category_cooldowns.push_back(cc);
|
||||
Cooldown cd;
|
||||
cd.id = category_id;
|
||||
cd.cooldown = value;
|
||||
|
||||
_s_active_category_cooldowns |= category_id;
|
||||
_s_category_cooldowns.push_back(cd);
|
||||
|
||||
notification_scategory_cooldown_added(cc);
|
||||
|
||||
emit_signal("scategory_cooldown_added", cc);
|
||||
notification_scategory_cooldown_added(category_id, value);
|
||||
|
||||
ORPC(category_cooldown_addc, category_id, value);
|
||||
}
|
||||
void Entity::category_cooldown_removes(int category_id) {
|
||||
Ref<CategoryCooldown> cc;
|
||||
Cooldown cc;
|
||||
bool found = false;
|
||||
|
||||
for (int i = 0; i < _s_category_cooldowns.size(); ++i) {
|
||||
if (_s_category_cooldowns.get(i)->get_category_id() == category_id) {
|
||||
if (_s_category_cooldowns[i].id == category_id) {
|
||||
cc = _s_category_cooldowns.get(i);
|
||||
_s_category_cooldowns.remove(i);
|
||||
found = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!cc.is_valid())
|
||||
if (!found)
|
||||
return;
|
||||
|
||||
_s_active_category_cooldowns ^= category_id;
|
||||
|
||||
notification_scategory_cooldown_removed(cc);
|
||||
|
||||
emit_signal("scategory_cooldown_removed", cc);
|
||||
notification_scategory_cooldown_removed(cc.id, cc.cooldown);
|
||||
|
||||
ORPC(category_cooldown_removec, category_id);
|
||||
}
|
||||
Ref<CategoryCooldown> Entity::category_cooldown_gets(int category_id) {
|
||||
ERR_FAIL_COND_V(!(category_id & _s_active_category_cooldowns), Ref<CategoryCooldown>());
|
||||
|
||||
Ref<CategoryCooldown> cc;
|
||||
float Entity::category_cooldown_gets(int category_id) {
|
||||
ERR_FAIL_COND_V(!(category_id & _s_active_category_cooldowns), 0);
|
||||
|
||||
for (int i = 0; i < _s_category_cooldowns.size(); ++i) {
|
||||
cc = _s_category_cooldowns.get(i);
|
||||
|
||||
if (cc->get_category_id() == category_id) {
|
||||
return cc;
|
||||
if (_s_category_cooldowns[i].id == category_id) {
|
||||
return _s_category_cooldowns[i].cooldown;
|
||||
}
|
||||
}
|
||||
|
||||
return cc;
|
||||
return 0;
|
||||
}
|
||||
Ref<CategoryCooldown> Entity::category_cooldown_gets_index(int index) {
|
||||
ERR_FAIL_INDEX_V(index, _s_category_cooldowns.size(), Ref<Cooldown>());
|
||||
float Entity::category_cooldown_gets_index(int index) {
|
||||
ERR_FAIL_INDEX_V(index, _s_category_cooldowns.size(), 0);
|
||||
|
||||
return _s_category_cooldowns.get(index);
|
||||
return _s_category_cooldowns.get(index).cooldown;
|
||||
}
|
||||
int Entity::category_cooldown_gets_count() {
|
||||
return _s_category_cooldowns.size();
|
||||
@ -4123,76 +4094,63 @@ bool Entity::category_cooldown_hasc(int category_id) {
|
||||
return (category_id & _c_active_category_cooldowns) > 0;
|
||||
}
|
||||
void Entity::category_cooldown_addc(int category_id, float value) {
|
||||
if (category_id & _c_active_category_cooldowns) {
|
||||
if ((category_id & _c_active_category_cooldowns)) {
|
||||
for (int i = 0; i < _c_category_cooldowns.size(); ++i) {
|
||||
Ref<CategoryCooldown> cc = _c_category_cooldowns.get(i);
|
||||
if (_c_category_cooldowns[i].id == category_id) {
|
||||
_c_category_cooldowns.write[i].cooldown = value;
|
||||
|
||||
if (cc->get_category_id() == category_id) {
|
||||
cc->set_remaining(value);
|
||||
notification_ccategory_cooldown_added(category_id, value);
|
||||
|
||||
notification_ccategory_cooldown_added(cc);
|
||||
|
||||
emit_signal("ccategory_cooldown_added", cc);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ref<CategoryCooldown> cc;
|
||||
cc.instance();
|
||||
|
||||
cc->set_category_id(category_id);
|
||||
cc->set_remaining(value);
|
||||
|
||||
_c_category_cooldowns.push_back(cc);
|
||||
Cooldown cd;
|
||||
cd.id = category_id;
|
||||
cd.cooldown = value;
|
||||
|
||||
_c_category_cooldowns.push_back(cd);
|
||||
_c_active_category_cooldowns |= category_id;
|
||||
|
||||
notification_ccategory_cooldown_added(cc);
|
||||
|
||||
emit_signal("ccategory_cooldown_added", cc);
|
||||
notification_ccategory_cooldown_added(category_id, value);
|
||||
}
|
||||
void Entity::category_cooldown_removec(int category_id) {
|
||||
Ref<CategoryCooldown> cc;
|
||||
Cooldown cc;
|
||||
bool found = false;
|
||||
|
||||
for (int i = 0; i < _c_category_cooldowns.size(); ++i) {
|
||||
if (_c_category_cooldowns.get(i)->get_category_id() == category_id) {
|
||||
if (_c_category_cooldowns[i].id == category_id) {
|
||||
cc = _c_category_cooldowns.get(i);
|
||||
|
||||
_c_category_cooldowns.remove(i);
|
||||
found = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!cc.is_valid())
|
||||
if (!found)
|
||||
return;
|
||||
|
||||
_c_active_category_cooldowns ^= category_id;
|
||||
|
||||
notification_ccategory_cooldown_removed(cc);
|
||||
|
||||
emit_signal("ccategory_cooldown_removed", cc);
|
||||
notification_ccategory_cooldown_removed(cc.id, cc.cooldown);
|
||||
}
|
||||
Ref<CategoryCooldown> Entity::category_cooldown_getc(int category_id) {
|
||||
ERR_FAIL_COND_V(!(category_id & _c_active_category_cooldowns), Ref<CategoryCooldown>());
|
||||
|
||||
Ref<CategoryCooldown> cc;
|
||||
float Entity::category_cooldown_getc(int category_id) {
|
||||
ERR_FAIL_COND_V(!(category_id & _c_active_category_cooldowns), 0);
|
||||
|
||||
for (int i = 0; i < _c_category_cooldowns.size(); ++i) {
|
||||
cc = _c_category_cooldowns.get(i);
|
||||
|
||||
if (cc->get_category_id() == category_id) {
|
||||
return cc;
|
||||
if (_c_category_cooldowns[i].id == category_id) {
|
||||
return _c_category_cooldowns[i].cooldown;
|
||||
}
|
||||
}
|
||||
|
||||
return cc;
|
||||
return 0;
|
||||
}
|
||||
Ref<CategoryCooldown> Entity::category_cooldown_getc_index(int index) {
|
||||
ERR_FAIL_INDEX_V(index, _c_category_cooldowns.size(), Ref<Cooldown>());
|
||||
float Entity::category_cooldown_getc_index(int index) {
|
||||
ERR_FAIL_INDEX_V(index, _c_category_cooldowns.size(), 0);
|
||||
|
||||
return _c_category_cooldowns.get(index);
|
||||
return _c_category_cooldowns[index].cooldown;
|
||||
}
|
||||
int Entity::category_cooldown_getc_count() {
|
||||
return _c_category_cooldowns.size();
|
||||
@ -5518,31 +5476,35 @@ void Entity::update(float delta) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < _c_cooldowns.size(); ++i) {
|
||||
Ref<Cooldown> cd = _c_cooldowns.get(i);
|
||||
|
||||
cd->update(delta);
|
||||
_c_cooldowns.write[i].cooldown -= delta;
|
||||
}
|
||||
|
||||
for (int i = 0; i < _c_category_cooldowns.size(); ++i) {
|
||||
Ref<CategoryCooldown> cd = _c_category_cooldowns.get(i);
|
||||
|
||||
cd->update(delta);
|
||||
_c_category_cooldowns.write[i].cooldown -= delta;
|
||||
}
|
||||
|
||||
for (int i = 0; i < _s_cooldowns.size(); ++i) {
|
||||
Ref<Cooldown> cd = _s_cooldowns.get(i);
|
||||
float cd = _s_cooldowns[i].cooldown;
|
||||
|
||||
if (cd->update(delta)) {
|
||||
cooldown_removes(cd->get_spell_id());
|
||||
cd -= delta;
|
||||
|
||||
_s_cooldowns.write[i].cooldown = cd;
|
||||
|
||||
if (cd <= 0) {
|
||||
cooldown_removes(_s_cooldowns[i].id);
|
||||
--i;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < _s_category_cooldowns.size(); ++i) {
|
||||
Ref<CategoryCooldown> cd = _s_category_cooldowns.get(i);
|
||||
float cd = _s_category_cooldowns[i].cooldown;
|
||||
|
||||
if (cd->update(delta)) {
|
||||
category_cooldown_removes(cd->get_category_id());
|
||||
cd -= delta;
|
||||
|
||||
_s_category_cooldowns.write[i].cooldown = cd;
|
||||
|
||||
if (cd <= 0) {
|
||||
category_cooldown_removes(_s_category_cooldowns[i].id);
|
||||
--i;
|
||||
}
|
||||
}
|
||||
@ -6127,9 +6089,6 @@ Entity::~Entity() {
|
||||
_s_cooldowns.clear();
|
||||
_c_cooldowns.clear();
|
||||
|
||||
_s_cooldown_map.clear();
|
||||
_c_cooldown_map.clear();
|
||||
|
||||
_s_category_cooldowns.clear();
|
||||
_c_category_cooldowns.clear();
|
||||
|
||||
@ -6532,7 +6491,7 @@ bool Entity::_set(const StringName &p_name, const Variant &p_value) {
|
||||
Dictionary cds = dict.get("cooldowns", Dictionary());
|
||||
|
||||
for (int i = 0; i < cds.size(); ++i) {
|
||||
Ref<Cooldown> cd;
|
||||
Cooldown cd;
|
||||
cd.instance();
|
||||
|
||||
cd->from_dict(cds.get(String::num(i), Dictionary()));
|
||||
@ -6544,7 +6503,7 @@ bool Entity::_set(const StringName &p_name, const Variant &p_value) {
|
||||
Dictionary ccds = dict.get("category_cooldowns", Dictionary());
|
||||
|
||||
for (int i = 0; i < ccds.size(); ++i) {
|
||||
Ref<CategoryCooldown> ccd;
|
||||
Cooldown ccd;
|
||||
ccd.instance();
|
||||
|
||||
ccd->from_dict(ccds.get(String::num(i), Dictionary()));
|
||||
@ -7125,13 +7084,29 @@ void Entity::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("character_talent_getc_count"), &Entity::character_talent_getc_count);
|
||||
ClassDB::bind_method(D_METHOD("character_talent_cclear"), &Entity::character_talent_cclear);
|
||||
|
||||
//Cooldowns
|
||||
BIND_VMETHOD(MethodInfo("notification_scooldown_added", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
BIND_VMETHOD(MethodInfo("notification_scooldown_removed", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
BIND_VMETHOD(MethodInfo("notification_scategory_cooldown_added", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
BIND_VMETHOD(MethodInfo("notification_scategory_cooldown_removed", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("notification_scooldown_added", "cooldown"), &Entity::notification_scooldown_added);
|
||||
ClassDB::bind_method(D_METHOD("notification_scooldown_removed", "cooldown"), &Entity::notification_scooldown_removed);
|
||||
ClassDB::bind_method(D_METHOD("notification_scategory_cooldown_added", "category_cooldown"), &Entity::notification_scategory_cooldown_added);
|
||||
ClassDB::bind_method(D_METHOD("notification_scategory_cooldown_removed", "category_cooldown"), &Entity::notification_scategory_cooldown_removed);
|
||||
|
||||
//Clientside EventHandlers
|
||||
BIND_VMETHOD(MethodInfo("_notification_cdeath"));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("notification_ccooldown_added", PropertyInfo(Variant::OBJECT, "cooldown", PROPERTY_HINT_RESOURCE_TYPE, "Cooldown")));
|
||||
BIND_VMETHOD(MethodInfo("notification_ccooldown_removed", PropertyInfo(Variant::OBJECT, "cooldown", PROPERTY_HINT_RESOURCE_TYPE, "Cooldown")));
|
||||
BIND_VMETHOD(MethodInfo("notification_ccategory_cooldown_added", PropertyInfo(Variant::OBJECT, "category_cooldown", PROPERTY_HINT_RESOURCE_TYPE, "CategoryCooldown")));
|
||||
BIND_VMETHOD(MethodInfo("notification_ccategory_cooldown_removed", PropertyInfo(Variant::OBJECT, "category_cooldown", PROPERTY_HINT_RESOURCE_TYPE, "CategoryCooldown")));
|
||||
BIND_VMETHOD(MethodInfo("notification_ccooldown_added", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
BIND_VMETHOD(MethodInfo("notification_ccooldown_removed", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
BIND_VMETHOD(MethodInfo("notification_ccategory_cooldown_added", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
BIND_VMETHOD(MethodInfo("notification_ccategory_cooldown_removed", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("notification_ccooldown_added", "cooldown"), &Entity::notification_ccooldown_added);
|
||||
ClassDB::bind_method(D_METHOD("notification_ccooldown_removed", "cooldown"), &Entity::notification_ccooldown_removed);
|
||||
ClassDB::bind_method(D_METHOD("notification_ccategory_cooldown_added", "category_cooldown"), &Entity::notification_ccategory_cooldown_added);
|
||||
ClassDB::bind_method(D_METHOD("notification_ccategory_cooldown_removed", "category_cooldown"), &Entity::notification_ccategory_cooldown_removed);
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_notification_cgcd_started", PropertyInfo(Variant::REAL, "gcd")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_cgcd_finished"));
|
||||
@ -7152,11 +7127,6 @@ void Entity::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("notification_cdeath"), &Entity::notification_cdeath);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("notification_ccooldown_added", "cooldown"), &Entity::notification_ccooldown_added);
|
||||
ClassDB::bind_method(D_METHOD("notification_ccooldown_removed", "cooldown"), &Entity::notification_ccooldown_removed);
|
||||
ClassDB::bind_method(D_METHOD("notification_ccategory_cooldown_added", "category_cooldown"), &Entity::notification_ccategory_cooldown_added);
|
||||
ClassDB::bind_method(D_METHOD("notification_ccategory_cooldown_removed", "category_cooldown"), &Entity::notification_ccategory_cooldown_removed);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("notification_cgcd_started"), &Entity::notification_cgcd_started);
|
||||
ClassDB::bind_method(D_METHOD("notification_cgcd_finished"), &Entity::notification_cgcd_finished);
|
||||
|
||||
@ -7606,10 +7576,10 @@ void Entity::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("cooldown_getc_count"), &Entity::cooldown_getc_count);
|
||||
|
||||
//Category Cooldowns
|
||||
ADD_SIGNAL(MethodInfo("scategory_cooldown_added", PropertyInfo(Variant::OBJECT, "cooldown", PROPERTY_HINT_RESOURCE_TYPE, "CategoryCooldown")));
|
||||
ADD_SIGNAL(MethodInfo("scategory_cooldown_removed", PropertyInfo(Variant::OBJECT, "cooldown", PROPERTY_HINT_RESOURCE_TYPE, "CategoryCooldown")));
|
||||
ADD_SIGNAL(MethodInfo("ccategory_cooldown_added", PropertyInfo(Variant::OBJECT, "cooldown", PROPERTY_HINT_RESOURCE_TYPE, "CategoryCooldown")));
|
||||
ADD_SIGNAL(MethodInfo("ccategory_cooldown_removed", PropertyInfo(Variant::OBJECT, "cooldown", PROPERTY_HINT_RESOURCE_TYPE, "CategoryCooldown")));
|
||||
ADD_SIGNAL(MethodInfo("scategory_cooldown_added", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
ADD_SIGNAL(MethodInfo("scategory_cooldown_removed", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
ADD_SIGNAL(MethodInfo("ccategory_cooldown_added", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
ADD_SIGNAL(MethodInfo("ccategory_cooldown_removed", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("category_cooldown_hass", "category_id"), &Entity::category_cooldown_hass);
|
||||
ClassDB::bind_method(D_METHOD("category_cooldown_adds", "category_id", "value"), &Entity::category_cooldown_adds);
|
||||
|
@ -47,8 +47,6 @@ SOFTWARE.
|
||||
#include "../utility/entity_create_info.h"
|
||||
|
||||
#include "../inventory/bag.h"
|
||||
#include "../utility/category_cooldown.h"
|
||||
#include "../utility/cooldown.h"
|
||||
#include "./data/entity_data_container.h"
|
||||
|
||||
#include "../profiles/actionbar/action_bar_profile.h"
|
||||
@ -525,11 +523,11 @@ public:
|
||||
void notification_scast(int what, Ref<SpellCastInfo> info);
|
||||
void notification_sdamage(int what, Ref<SpellDamageInfo> info);
|
||||
|
||||
void notification_scooldown_added(Ref<Cooldown> cooldown);
|
||||
void notification_scooldown_removed(Ref<Cooldown> cooldown);
|
||||
void notification_scooldown_added(int id, float value);
|
||||
void notification_scooldown_removed(int id, float value);
|
||||
|
||||
void notification_scategory_cooldown_added(Ref<CategoryCooldown> category_cooldown);
|
||||
void notification_scategory_cooldown_removed(Ref<CategoryCooldown> category_cooldown);
|
||||
void notification_scategory_cooldown_added(int id, float value);
|
||||
void notification_scategory_cooldown_removed(int id, float value);
|
||||
|
||||
void notification_sentity_resource_added(Ref<EntityResource> resource);
|
||||
void notification_sentity_resource_removed(Ref<EntityResource> resource);
|
||||
@ -548,11 +546,11 @@ public:
|
||||
void notification_ccast(int what, Ref<SpellCastInfo> info);
|
||||
void notification_cdamage(int what, Ref<SpellDamageInfo> info);
|
||||
|
||||
void notification_ccooldown_added(Ref<Cooldown> cooldown);
|
||||
void notification_ccooldown_removed(Ref<Cooldown> cooldown);
|
||||
void notification_ccooldown_added(int id, float value);
|
||||
void notification_ccooldown_removed(int id, float value);
|
||||
|
||||
void notification_ccategory_cooldown_added(Ref<CategoryCooldown> category_cooldown);
|
||||
void notification_ccategory_cooldown_removed(Ref<CategoryCooldown> category_cooldown);
|
||||
void notification_ccategory_cooldown_added(int id, float value);
|
||||
void notification_ccategory_cooldown_removed(int id, float value);
|
||||
|
||||
void notification_centity_resource_added(Ref<EntityResource> resource);
|
||||
void notification_centity_resource_removed(Ref<EntityResource> resource);
|
||||
@ -698,43 +696,34 @@ public:
|
||||
|
||||
//// Cooldowns ////
|
||||
|
||||
Vector<Ref<Cooldown> > *cooldowns_gets();
|
||||
Vector<Ref<Cooldown> > *cooldowns_getc();
|
||||
|
||||
HashMap<int, Ref<Cooldown> > *cooldown_get_maps();
|
||||
HashMap<int, Ref<Cooldown> > *cooldown_get_mapc();
|
||||
|
||||
bool cooldown_hass(int spell_id);
|
||||
void cooldown_adds(int spell_id, float value);
|
||||
void cooldown_removes(int spell_id);
|
||||
Ref<Cooldown> cooldown_gets(int spell_id);
|
||||
Ref<Cooldown> cooldown_gets_index(int index);
|
||||
float cooldown_gets(int spell_id);
|
||||
float cooldown_gets_index(int index);
|
||||
int cooldown_gets_count();
|
||||
|
||||
bool cooldown_hasc(int spell_id);
|
||||
void cooldown_addc(int spell_id, float value);
|
||||
void cooldown_removec(int spell_id);
|
||||
Ref<Cooldown> cooldown_getc(int spell_id);
|
||||
Ref<Cooldown> cooldown_getc_index(int index);
|
||||
float cooldown_getc(int spell_id);
|
||||
float cooldown_getc_index(int index);
|
||||
int cooldown_getc_count();
|
||||
|
||||
//Category Cooldowns
|
||||
|
||||
Vector<Ref<CategoryCooldown> > category_cooldowns_gets();
|
||||
Vector<Ref<CategoryCooldown> > category_cooldowns_getc();
|
||||
|
||||
bool category_cooldown_hass(int category_id);
|
||||
void category_cooldown_adds(int category_id, float value);
|
||||
void category_cooldown_removes(int category_id);
|
||||
Ref<CategoryCooldown> category_cooldown_gets(int category_id);
|
||||
Ref<CategoryCooldown> category_cooldown_gets_index(int index);
|
||||
float category_cooldown_gets(int category_id);
|
||||
float category_cooldown_gets_index(int index);
|
||||
int category_cooldown_gets_count();
|
||||
|
||||
bool category_cooldown_hasc(int category_id);
|
||||
void category_cooldown_addc(int category_id, float value);
|
||||
void category_cooldown_removec(int spell_id);
|
||||
Ref<CategoryCooldown> category_cooldown_getc(int category_id);
|
||||
Ref<CategoryCooldown> category_cooldown_getc_index(int index);
|
||||
float category_cooldown_getc(int category_id);
|
||||
float category_cooldown_getc_index(int index);
|
||||
int category_cooldown_getc_count();
|
||||
|
||||
//Known Spells
|
||||
@ -1080,6 +1069,18 @@ protected:
|
||||
static void _bind_methods();
|
||||
virtual void _notification(int p_what);
|
||||
|
||||
protected:
|
||||
struct Cooldown {
|
||||
int id;
|
||||
StringName path;
|
||||
float cooldown;
|
||||
|
||||
Cooldown() {
|
||||
id = 0;
|
||||
cooldown = 0;
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
bool _maunal_process;
|
||||
|
||||
@ -1197,14 +1198,11 @@ private:
|
||||
int _c_entity_flags;
|
||||
|
||||
//// Cooldowns ////
|
||||
Vector<Ref<Cooldown> > _s_cooldowns;
|
||||
Vector<Ref<Cooldown> > _c_cooldowns;
|
||||
Vector<Cooldown> _s_cooldowns;
|
||||
Vector<Cooldown> _c_cooldowns;
|
||||
|
||||
HashMap<int, Ref<Cooldown> > _s_cooldown_map;
|
||||
HashMap<int, Ref<Cooldown> > _c_cooldown_map;
|
||||
|
||||
Vector<Ref<CategoryCooldown> > _s_category_cooldowns;
|
||||
Vector<Ref<CategoryCooldown> > _c_category_cooldowns;
|
||||
Vector<Cooldown> _s_category_cooldowns;
|
||||
Vector<Cooldown> _c_category_cooldowns;
|
||||
|
||||
int _s_active_category_cooldowns;
|
||||
int _c_active_category_cooldowns;
|
||||
|
@ -98,8 +98,6 @@ SOFTWARE.
|
||||
|
||||
#include "skeleton/skeleton_model_entry.h"
|
||||
|
||||
#include "utility/category_cooldown.h"
|
||||
#include "utility/cooldown.h"
|
||||
#include "utility/entity_create_info.h"
|
||||
|
||||
#include "data/loot/loot_data_base.h"
|
||||
@ -226,9 +224,6 @@ void register_entity_spell_system_types() {
|
||||
|
||||
ClassDB::register_class<SkeletonModelEntry>();
|
||||
|
||||
ClassDB::register_class<Cooldown>();
|
||||
ClassDB::register_class<CategoryCooldown>();
|
||||
|
||||
ClassDB::register_class<LootDataBase>();
|
||||
|
||||
ClassDB::register_class<SpellEffectVisual>();
|
||||
|
@ -1,97 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2020 Péter Magyar
|
||||
|
||||
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 "category_cooldown.h"
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
int CategoryCooldown::get_category_id() const {
|
||||
return _category_id;
|
||||
}
|
||||
|
||||
void CategoryCooldown::set_category_id(const int value) {
|
||||
_category_id = value;
|
||||
}
|
||||
|
||||
float CategoryCooldown::get_remaining() const {
|
||||
return _remaining;
|
||||
}
|
||||
|
||||
void CategoryCooldown::set_remaining(const float value) {
|
||||
_remaining = value;
|
||||
}
|
||||
|
||||
bool CategoryCooldown::update(const float delta) {
|
||||
_remaining -= delta;
|
||||
|
||||
if (_remaining <= 0) {
|
||||
_remaining = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Dictionary CategoryCooldown::to_dict() {
|
||||
return call("_to_dict");
|
||||
}
|
||||
void CategoryCooldown::from_dict(const Dictionary &dict) {
|
||||
call("_from_dict", dict);
|
||||
}
|
||||
|
||||
Dictionary CategoryCooldown::_to_dict() {
|
||||
Dictionary dict;
|
||||
|
||||
dict["category_id"] = _category_id;
|
||||
dict["remaining"] = _remaining;
|
||||
|
||||
return dict;
|
||||
}
|
||||
void CategoryCooldown::_from_dict(const Dictionary &dict) {
|
||||
ERR_FAIL_COND(dict.empty());
|
||||
|
||||
_category_id = dict.get("category_id", 0);
|
||||
_remaining = dict.get("remaining", 0);
|
||||
}
|
||||
|
||||
void CategoryCooldown::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_category_id"), &CategoryCooldown::get_category_id);
|
||||
ClassDB::bind_method(D_METHOD("set_category_id", "value"), &CategoryCooldown::set_category_id);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "category_id"), "set_category_id", "get_category_id");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_remaining"), &CategoryCooldown::get_remaining);
|
||||
ClassDB::bind_method(D_METHOD("set_remaining", "value"), &CategoryCooldown::set_remaining);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "remaining"), "set_remaining", "get_remaining");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("update", "delta"), &CategoryCooldown::update);
|
||||
|
||||
//Serialization
|
||||
BIND_VMETHOD(MethodInfo("_from_dict", PropertyInfo(Variant::DICTIONARY, "dict")));
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::DICTIONARY, "dict"), "_to_dict"));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("from_dict", "dict"), &CategoryCooldown::from_dict);
|
||||
ClassDB::bind_method(D_METHOD("to_dict"), &CategoryCooldown::to_dict);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_from_dict", "dict"), &CategoryCooldown::_from_dict);
|
||||
ClassDB::bind_method(D_METHOD("_to_dict"), &CategoryCooldown::_to_dict);
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2020 Péter Magyar
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef CATEGORY_COOLDOWN_H
|
||||
#define CATEGORY_COOLDOWN_H
|
||||
|
||||
#include "core/resource.h"
|
||||
|
||||
class CategoryCooldown : public Resource {
|
||||
GDCLASS(CategoryCooldown, Resource);
|
||||
|
||||
public:
|
||||
int get_category_id() const;
|
||||
void set_category_id(const int value);
|
||||
|
||||
float get_remaining() const;
|
||||
void set_remaining(const float value);
|
||||
|
||||
bool update(const float delta);
|
||||
|
||||
Dictionary to_dict();
|
||||
void from_dict(const Dictionary &dict);
|
||||
|
||||
Dictionary _to_dict();
|
||||
void _from_dict(const Dictionary &dict);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
int _category_id;
|
||||
float _remaining;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,104 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2020 Péter Magyar
|
||||
|
||||
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 "cooldown.h"
|
||||
|
||||
#include "../database/ess_resource_db.h"
|
||||
#include "../singletons/ess.h"
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
int Cooldown::get_spell_id() const {
|
||||
return _spell_id;
|
||||
}
|
||||
|
||||
void Cooldown::set_spell_id(const int value) {
|
||||
_spell_id = value;
|
||||
}
|
||||
|
||||
float Cooldown::get_remaining() const {
|
||||
return _remaining;
|
||||
}
|
||||
|
||||
void Cooldown::set_remaining(const float value) {
|
||||
_remaining = value;
|
||||
}
|
||||
|
||||
bool Cooldown::update(const float delta) {
|
||||
_remaining -= delta;
|
||||
|
||||
if (_remaining <= 0) {
|
||||
_remaining = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Dictionary Cooldown::to_dict() {
|
||||
return call("_to_dict");
|
||||
}
|
||||
void Cooldown::from_dict(const Dictionary &dict) {
|
||||
call("_from_dict", dict);
|
||||
}
|
||||
|
||||
Dictionary Cooldown::_to_dict() {
|
||||
Dictionary dict;
|
||||
|
||||
//dict["spell_id"] = _spell_id;
|
||||
dict["spell_path"] = ESS::get_singleton()->get_resource_db()->spell_id_to_path(_spell_id);
|
||||
dict["remaining"] = _remaining;
|
||||
|
||||
return dict;
|
||||
}
|
||||
void Cooldown::_from_dict(const Dictionary &dict) {
|
||||
ERR_FAIL_COND(dict.empty());
|
||||
ERR_FAIL_COND(!ESS::get_singleton()->get_resource_db().is_valid());
|
||||
|
||||
StringName spell_path = dict.get("spell_path", "");
|
||||
//_spell_id = dict.get("spell_id", 0);
|
||||
_spell_id = ESS::get_singleton()->get_resource_db()->spell_path_to_id(spell_path);
|
||||
_remaining = dict.get("remaining", 0);
|
||||
}
|
||||
|
||||
void Cooldown::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_spell_id"), &Cooldown::get_spell_id);
|
||||
ClassDB::bind_method(D_METHOD("set_spell_id", "value"), &Cooldown::set_spell_id);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "spell_id"), "set_spell_id", "get_spell_id");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_remaining"), &Cooldown::get_remaining);
|
||||
ClassDB::bind_method(D_METHOD("set_remaining", "value"), &Cooldown::set_remaining);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "remaining"), "set_remaining", "get_remaining");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("update", "delta"), &Cooldown::update);
|
||||
|
||||
//Serialization
|
||||
BIND_VMETHOD(MethodInfo("_from_dict", PropertyInfo(Variant::DICTIONARY, "dict")));
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::DICTIONARY, "dict"), "_to_dict"));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("from_dict", "dict"), &Cooldown::from_dict);
|
||||
ClassDB::bind_method(D_METHOD("to_dict"), &Cooldown::to_dict);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_from_dict", "dict"), &Cooldown::_from_dict);
|
||||
ClassDB::bind_method(D_METHOD("_to_dict"), &Cooldown::_to_dict);
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2020 Péter Magyar
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef COOLDOWN_H
|
||||
#define COOLDOWN_H
|
||||
|
||||
#include "core/resource.h"
|
||||
|
||||
class Cooldown : public Resource {
|
||||
GDCLASS(Cooldown, Resource);
|
||||
|
||||
public:
|
||||
int get_spell_id() const;
|
||||
void set_spell_id(const int value);
|
||||
|
||||
float get_remaining() const;
|
||||
void set_remaining(const float value);
|
||||
|
||||
bool update(const float delta);
|
||||
|
||||
Dictionary to_dict();
|
||||
void from_dict(const Dictionary &dict);
|
||||
|
||||
Dictionary _to_dict();
|
||||
void _from_dict(const Dictionary &dict);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
int _spell_id;
|
||||
float _remaining;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user