mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-05-11 22:42:10 +02:00
-Renamed CharacterSkeletonBoneId to CharacterSkeletonPoints.
-Added rank to spells. -Removed The Icon class, and the SpellManager. -More cleanup. -Removed more collection dynamic allocations.
This commit is contained in:
parent
49f2213b12
commit
9aaa5d1d5a
7
SCsub
7
SCsub
@ -1,8 +1,5 @@
|
|||||||
Import('env')
|
Import('env')
|
||||||
|
|
||||||
if ARGUMENTS.get('entity_mem_tools', 'no') == 'yes':
|
|
||||||
env.Append(CPPDEFINES=['ENTITY_MEM_TOOLS'])
|
|
||||||
|
|
||||||
if ARGUMENTS.get('entities_2d', 'no') == 'yes':
|
if ARGUMENTS.get('entities_2d', 'no') == 'yes':
|
||||||
env.Append(CPPDEFINES=['ENTITIES_2D'])
|
env.Append(CPPDEFINES=['ENTITIES_2D'])
|
||||||
|
|
||||||
@ -34,8 +31,6 @@ module_env.add_source_files(env.modules_sources,"data/craft_data_attribute.cpp")
|
|||||||
module_env.add_source_files(env.modules_sources,"data/spell.cpp")
|
module_env.add_source_files(env.modules_sources,"data/spell.cpp")
|
||||||
module_env.add_source_files(env.modules_sources,"data/spell/spell_data_constants.cpp")
|
module_env.add_source_files(env.modules_sources,"data/spell/spell_data_constants.cpp")
|
||||||
|
|
||||||
module_env.add_source_files(env.modules_sources,"data/icon.cpp")
|
|
||||||
|
|
||||||
module_env.add_source_files(env.modules_sources,"entities/stats/stat.cpp")
|
module_env.add_source_files(env.modules_sources,"entities/stats/stat.cpp")
|
||||||
module_env.add_source_files(env.modules_sources,"entities/stats/stat_data.cpp")
|
module_env.add_source_files(env.modules_sources,"entities/stats/stat_data.cpp")
|
||||||
|
|
||||||
@ -55,8 +50,6 @@ module_env.add_source_files(env.modules_sources,"entities/entity.cpp")
|
|||||||
module_env.add_source_files(env.modules_sources,"entities/player.cpp")
|
module_env.add_source_files(env.modules_sources,"entities/player.cpp")
|
||||||
module_env.add_source_files(env.modules_sources,"entities/mob.cpp")
|
module_env.add_source_files(env.modules_sources,"entities/mob.cpp")
|
||||||
|
|
||||||
module_env.add_source_files(env.modules_sources,"spells/spell_manager.cpp")
|
|
||||||
|
|
||||||
module_env.add_source_files(env.modules_sources,"ui/unit_frame.cpp")
|
module_env.add_source_files(env.modules_sources,"ui/unit_frame.cpp")
|
||||||
|
|
||||||
module_env.add_source_files(env.modules_sources,"drag_and_drop/es_drag_and_drop.cpp")
|
module_env.add_source_files(env.modules_sources,"drag_and_drop/es_drag_and_drop.cpp")
|
||||||
|
@ -130,6 +130,14 @@ void Aura::OnAuraAbilityScalingDataLoaded(AbilityScalingDataLoaderHelper *h) {
|
|||||||
bool Aura::has_effect_visual() {
|
bool Aura::has_effect_visual() {
|
||||||
return _effect_visual.is_valid();
|
return _effect_visual.is_valid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EntityEnums::CharacterSkeletonPoints Aura::get_effect_visual_point() {
|
||||||
|
return _effect_visual_point;
|
||||||
|
}
|
||||||
|
void Aura::set_effect_visual_point(EntityEnums::CharacterSkeletonPoints point) {
|
||||||
|
_effect_visual_point = point;
|
||||||
|
}
|
||||||
|
|
||||||
Ref<PackedScene> Aura::get_effect_visual() {
|
Ref<PackedScene> Aura::get_effect_visual() {
|
||||||
return _effect_visual;
|
return _effect_visual;
|
||||||
}
|
}
|
||||||
@ -889,6 +897,11 @@ void Aura::_bind_methods() {
|
|||||||
//Visual Effect
|
//Visual Effect
|
||||||
ADD_GROUP("Visual Effect", "effect");
|
ADD_GROUP("Visual Effect", "effect");
|
||||||
ClassDB::bind_method(D_METHOD("has_effect_visual"), &Aura::has_effect_visual);
|
ClassDB::bind_method(D_METHOD("has_effect_visual"), &Aura::has_effect_visual);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_effect_visual_point"), &Aura::get_effect_visual_point);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_effect_visual_point", "value"), &Aura::set_effect_visual_point);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "effect_visual_point", PROPERTY_HINT_ENUM, EntityEnums::BINDING_STRING_CHARCATER_SKELETON_POINTS), "set_effect_visual_point", "get_effect_visual_point");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_effect_visual"), &Aura::get_effect_visual);
|
ClassDB::bind_method(D_METHOD("get_effect_visual"), &Aura::get_effect_visual);
|
||||||
ClassDB::bind_method(D_METHOD("set_effect_visual", "value"), &Aura::set_effect_visual);
|
ClassDB::bind_method(D_METHOD("set_effect_visual", "value"), &Aura::set_effect_visual);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "effect_visual", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "set_effect_visual", "get_effect_visual");
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "effect_visual", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "set_effect_visual", "get_effect_visual");
|
||||||
|
@ -72,6 +72,10 @@ public:
|
|||||||
|
|
||||||
//VisualEffect
|
//VisualEffect
|
||||||
bool has_effect_visual();
|
bool has_effect_visual();
|
||||||
|
|
||||||
|
EntityEnums::CharacterSkeletonPoints get_effect_visual_point();
|
||||||
|
void set_effect_visual_point(EntityEnums::CharacterSkeletonPoints point);
|
||||||
|
|
||||||
Ref<PackedScene> get_effect_visual();
|
Ref<PackedScene> get_effect_visual();
|
||||||
void set_effect_visual(Ref<PackedScene> value);
|
void set_effect_visual(Ref<PackedScene> value);
|
||||||
|
|
||||||
@ -338,6 +342,7 @@ private:
|
|||||||
String _aura_description;
|
String _aura_description;
|
||||||
int ability_scale_data_id;
|
int ability_scale_data_id;
|
||||||
|
|
||||||
|
EntityEnums::CharacterSkeletonPoints _effect_visual_point;
|
||||||
Ref<PackedScene> _effect_visual;
|
Ref<PackedScene> _effect_visual;
|
||||||
|
|
||||||
bool _damage_enabled;
|
bool _damage_enabled;
|
||||||
|
@ -18,11 +18,11 @@ void BoneVisualAttachment::set_attachment_type(BoneVisualAttachment::BoneVisualA
|
|||||||
_attachment_type = attachment_type;
|
_attachment_type = attachment_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityEnums::CharacterSkeletonBoneId BoneVisualAttachment::get_target_bone() {
|
EntityEnums::CharacterSkeletonPoints BoneVisualAttachment::get_target_bone() {
|
||||||
return _target_bone;
|
return _target_bone;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoneVisualAttachment::set_target_bone(EntityEnums::CharacterSkeletonBoneId target_bone) {
|
void BoneVisualAttachment::set_target_bone(EntityEnums::CharacterSkeletonPoints target_bone) {
|
||||||
_target_bone = target_bone;
|
_target_bone = target_bone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ void BoneVisualAttachment::set_effect(Ref<PackedScene> effect) {
|
|||||||
|
|
||||||
BoneVisualAttachment::BoneVisualAttachment() {
|
BoneVisualAttachment::BoneVisualAttachment() {
|
||||||
_id = 0;
|
_id = 0;
|
||||||
_target_bone = EntityEnums::BONE_ID_HIP;
|
_target_bone = EntityEnums::SKELETON_POINT_BASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoneVisualAttachment::_bind_methods() {
|
void BoneVisualAttachment::_bind_methods() {
|
||||||
@ -50,7 +50,7 @@ void BoneVisualAttachment::_bind_methods() {
|
|||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_target_bone"), &BoneVisualAttachment::get_target_bone);
|
ClassDB::bind_method(D_METHOD("get_target_bone"), &BoneVisualAttachment::get_target_bone);
|
||||||
ClassDB::bind_method(D_METHOD("set_target_bone", "target_bone"), &BoneVisualAttachment::set_target_bone);
|
ClassDB::bind_method(D_METHOD("set_target_bone", "target_bone"), &BoneVisualAttachment::set_target_bone);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "target_bone", PROPERTY_HINT_ENUM, EntityEnums::BINDING_STRING_CHARCATER_SKELETON_BONE_ID), "set_target_bone", "get_target_bone");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "target_bone", PROPERTY_HINT_ENUM, EntityEnums::BINDING_STRING_CHARCATER_SKELETON_POINTS), "set_target_bone", "get_target_bone");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_effect"), &BoneVisualAttachment::get_effect);
|
ClassDB::bind_method(D_METHOD("get_effect"), &BoneVisualAttachment::get_effect);
|
||||||
ClassDB::bind_method(D_METHOD("set_effect", "path"), &BoneVisualAttachment::set_effect);
|
ClassDB::bind_method(D_METHOD("set_effect", "path"), &BoneVisualAttachment::set_effect);
|
||||||
|
@ -27,8 +27,8 @@ public:
|
|||||||
BoneVisualAttachmentType get_attachment_type();
|
BoneVisualAttachmentType get_attachment_type();
|
||||||
void set_attachment_type(BoneVisualAttachmentType attachment_type);
|
void set_attachment_type(BoneVisualAttachmentType attachment_type);
|
||||||
|
|
||||||
EntityEnums::CharacterSkeletonBoneId get_target_bone();
|
EntityEnums::CharacterSkeletonPoints get_target_bone();
|
||||||
void set_target_bone(EntityEnums::CharacterSkeletonBoneId bone);
|
void set_target_bone(EntityEnums::CharacterSkeletonPoints bone);
|
||||||
|
|
||||||
Ref<PackedScene> get_effect();
|
Ref<PackedScene> get_effect();
|
||||||
void set_effect(Ref<PackedScene> effect);
|
void set_effect(Ref<PackedScene> effect);
|
||||||
@ -41,7 +41,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
int _id;
|
int _id;
|
||||||
BoneVisualAttachmentType _attachment_type;
|
BoneVisualAttachmentType _attachment_type;
|
||||||
EntityEnums::CharacterSkeletonBoneId _target_bone;
|
EntityEnums::CharacterSkeletonPoints _target_bone;
|
||||||
Ref<PackedScene> _effect;
|
Ref<PackedScene> _effect;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,10 +3,6 @@
|
|||||||
#include "../data/spell.h"
|
#include "../data/spell.h"
|
||||||
#include "../entities/entity.h"
|
#include "../entities/entity.h"
|
||||||
|
|
||||||
#if ENTITY_MEM_TOOLS
|
|
||||||
int CharacterClass::allocs = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int CharacterClass::get_id() {
|
int CharacterClass::get_id() {
|
||||||
return _id;
|
return _id;
|
||||||
}
|
}
|
||||||
@ -250,11 +246,6 @@ CharacterClass::CharacterClass() {
|
|||||||
_num_specs = 0;
|
_num_specs = 0;
|
||||||
_num_spells = 0;
|
_num_spells = 0;
|
||||||
_current_spell_page = 0;
|
_current_spell_page = 0;
|
||||||
|
|
||||||
#if ENTITY_MEM_TOOLS
|
|
||||||
CharacterClass::allocs++;
|
|
||||||
print_error("CharacterClass alloc " + String::num(CharacterClass::allocs));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterClass::~CharacterClass() {
|
CharacterClass::~CharacterClass() {
|
||||||
@ -263,9 +254,4 @@ CharacterClass::~CharacterClass() {
|
|||||||
//for (int i = 0; i < MAX_SPELLS; ++i) {
|
//for (int i = 0; i < MAX_SPELLS; ++i) {
|
||||||
//_spells[i] = Ref<Spell>(NULL);
|
//_spells[i] = Ref<Spell>(NULL);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
#if ENTITY_MEM_TOOLS
|
|
||||||
CharacterClass::allocs--;
|
|
||||||
print_error("CharacterClass dealloc " + String::num(CharacterClass::allocs));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -122,10 +122,6 @@ private:
|
|||||||
//Vector<int> _mob_dislike_ids;
|
//Vector<int> _mob_dislike_ids;
|
||||||
|
|
||||||
//MobSpellData *_mob_spell_data;
|
//MobSpellData *_mob_spell_data;
|
||||||
|
|
||||||
#if ENTITY_MEM_TOOLS
|
|
||||||
static int allocs;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
#include "character_spec.h"
|
#include "character_spec.h"
|
||||||
|
|
||||||
#if ENTITY_MEM_TOOLS
|
|
||||||
int CharacterSpec::allocs = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int CharacterSpec::get_spec_id() {
|
int CharacterSpec::get_spec_id() {
|
||||||
return _spec_id;
|
return _spec_id;
|
||||||
}
|
}
|
||||||
@ -69,18 +65,9 @@ CharacterSpec::CharacterSpec() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_spec_id = 0;
|
_spec_id = 0;
|
||||||
|
|
||||||
#if ENTITY_MEM_TOOLS
|
|
||||||
CharacterSpec::allocs++;
|
|
||||||
print_error("CharacterSpec alloc " + String::num(CharacterSpec::allocs));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterSpec::~CharacterSpec() {
|
CharacterSpec::~CharacterSpec() {
|
||||||
#if ENTITY_MEM_TOOLS
|
|
||||||
CharacterSpec::allocs--;
|
|
||||||
print_error("CharacterSpec dealloc " + String::num(CharacterSpec::allocs));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterSpec::_bind_methods() {
|
void CharacterSpec::_bind_methods() {
|
||||||
|
@ -49,10 +49,6 @@ private:
|
|||||||
int _spec_id;
|
int _spec_id;
|
||||||
String _spec_name;
|
String _spec_name;
|
||||||
Ref<TalentRowData> _rows[MAX_TALENT_ROWS];
|
Ref<TalentRowData> _rows[MAX_TALENT_ROWS];
|
||||||
|
|
||||||
#if ENTITY_MEM_TOOLS
|
|
||||||
static int allocs;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
#include "craft_data_attribute.h"
|
#include "craft_data_attribute.h"
|
||||||
|
|
||||||
#if ENTITY_MEM_TOOLS
|
|
||||||
int CraftDataAttribute::allocs = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const String CraftDataAttribute::BINDING_STRING_CRAFT_CATEGORIES = "None, Alchemy";
|
const String CraftDataAttribute::BINDING_STRING_CRAFT_CATEGORIES = "None, Alchemy";
|
||||||
const String CraftDataAttribute::BINDING_STRING_CRAFT_SUB_CATEGORIES = "None, Potions";
|
const String CraftDataAttribute::BINDING_STRING_CRAFT_SUB_CATEGORIES = "None, Potions";
|
||||||
|
|
||||||
@ -88,22 +84,12 @@ CraftDataAttribute::CraftDataAttribute() {
|
|||||||
//for (int i = 0; i < MAX_REQUIRED_MATERIALS; ++i) {
|
//for (int i = 0; i < MAX_REQUIRED_MATERIALS; ++i) {
|
||||||
// _required_materials[i] = Ref<CraftDataAttributeHelper>(memnew(CraftDataAttributeHelper()));
|
// _required_materials[i] = Ref<CraftDataAttributeHelper>(memnew(CraftDataAttributeHelper()));
|
||||||
//}
|
//}
|
||||||
|
|
||||||
#if ENTITY_MEM_TOOLS
|
|
||||||
CraftDataAttribute::allocs++;
|
|
||||||
print_error("CraftDataAttribute alloc " + String::num(CraftDataAttribute::allocs));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CraftDataAttribute::~CraftDataAttribute() {
|
CraftDataAttribute::~CraftDataAttribute() {
|
||||||
//TODO check if the array destrutors actually unref the objects.
|
//TODO check if the array destrutors actually unref the objects.
|
||||||
|
|
||||||
//_item = Ref<CraftDataAttributeHelper>(NULL);
|
//_item = Ref<CraftDataAttributeHelper>(NULL);
|
||||||
|
|
||||||
#if ENTITY_MEM_TOOLS
|
|
||||||
CraftDataAttribute::allocs--;
|
|
||||||
print_error("CraftDataAttributede alloc " + String::num(CraftDataAttribute::allocs));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CraftDataAttribute::_validate_property(PropertyInfo &property) const {
|
void CraftDataAttribute::_validate_property(PropertyInfo &property) const {
|
||||||
|
@ -79,10 +79,6 @@ private:
|
|||||||
Ref<CraftDataAttributeHelper> _required_materials[MAX_REQUIRED_MATERIALS];
|
Ref<CraftDataAttributeHelper> _required_materials[MAX_REQUIRED_MATERIALS];
|
||||||
|
|
||||||
Ref<CraftDataAttributeHelper> _item;
|
Ref<CraftDataAttributeHelper> _item;
|
||||||
|
|
||||||
#if ENTITY_MEM_TOOLS
|
|
||||||
static int allocs;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
VARIANT_ENUM_CAST(CraftDataAttribute::CraftSubCategories);
|
VARIANT_ENUM_CAST(CraftDataAttribute::CraftSubCategories);
|
||||||
|
@ -23,10 +23,6 @@ protected:
|
|||||||
private:
|
private:
|
||||||
Ref<ItemTemplate> _item;
|
Ref<ItemTemplate> _item;
|
||||||
int _count;
|
int _count;
|
||||||
|
|
||||||
#if ENTITY_MEM_TOOLS
|
|
||||||
static int allocs;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "data_manager.h"
|
#include "data_manager.h"
|
||||||
|
|
||||||
#include "spell.h"
|
|
||||||
#include "aura.h"
|
#include "aura.h"
|
||||||
#include "character.h"
|
#include "character.h"
|
||||||
#include "craft_data_attribute.h"
|
#include "craft_data_attribute.h"
|
||||||
|
#include "spell.h"
|
||||||
|
|
||||||
DataManager *DataManager::instance;
|
DataManager *DataManager::instance;
|
||||||
|
|
||||||
@ -19,130 +19,180 @@ void DataManager::_notification(int p_what) {
|
|||||||
if (get_automatic_load()) {
|
if (get_automatic_load()) {
|
||||||
load_all();
|
load_all();
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<CharacterClass> DataManager::get_character_class(int class_id) {
|
String DataManager::get_character_classes_folder() {
|
||||||
ERR_FAIL_COND_V(!_character_class_map->has(class_id), Ref<CharacterClass>(NULL));
|
return _character_classes_folder;
|
||||||
|
}
|
||||||
|
|
||||||
return _character_class_map->get(class_id);
|
void DataManager::set_character_classes_folder(String folder) {
|
||||||
|
_character_classes_folder = folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector<Ref<CharacterClass> > *DataManager::get_character_classes() {
|
||||||
|
return &_character_classes;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ref<CharacterClass> DataManager::get_character_class(int class_id) {
|
||||||
|
ERR_FAIL_COND_V(!_character_class_map.has(class_id), Ref<CharacterClass>(NULL));
|
||||||
|
|
||||||
|
return _character_class_map.get(class_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<CharacterClass> DataManager::get_character_class_index(int index) {
|
Ref<CharacterClass> DataManager::get_character_class_index(int index) {
|
||||||
ERR_FAIL_INDEX_V(index, _character_classes->size(), Ref<CharacterClass>(NULL));
|
ERR_FAIL_INDEX_V(index, _character_classes.size(), Ref<CharacterClass>(NULL));
|
||||||
|
|
||||||
return _character_classes->get(index);
|
return _character_classes.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DataManager::get_character_class_count() {
|
int DataManager::get_character_class_count() {
|
||||||
return _character_classes->size();
|
return _character_classes.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataManager::add_character_class(Ref<CharacterClass> cls) {
|
void DataManager::add_character_class(Ref<CharacterClass> cls) {
|
||||||
ERR_FAIL_COND(!cls.is_valid());
|
ERR_FAIL_COND(!cls.is_valid());
|
||||||
|
|
||||||
_character_classes->push_back(cls);
|
_character_classes.push_back(cls);
|
||||||
_character_class_map->set(cls->get_id(), cls);
|
_character_class_map.set(cls->get_id(), cls);
|
||||||
|
}
|
||||||
|
|
||||||
|
String DataManager::get_spells_folder() {
|
||||||
|
return _spells_folder;
|
||||||
|
}
|
||||||
|
void DataManager::set_spells_folder(String folder) {
|
||||||
|
_spells_folder = folder;
|
||||||
|
}
|
||||||
|
Vector<Ref<Spell> > *DataManager::get_spells() {
|
||||||
|
return &_spells;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Spell> DataManager::get_spell(int spell_id) {
|
Ref<Spell> DataManager::get_spell(int spell_id) {
|
||||||
ERR_FAIL_COND_V(!_spell_map->has(spell_id), Ref<Spell>(NULL));
|
ERR_FAIL_COND_V(!_spell_map.has(spell_id), Ref<Spell>(NULL));
|
||||||
|
|
||||||
return _spell_map->get(spell_id);
|
return _spell_map.get(spell_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Spell> DataManager::get_spell_index(int index) {
|
Ref<Spell> DataManager::get_spell_index(int index) {
|
||||||
ERR_FAIL_INDEX_V(index, _spells->size(), Ref<Spell>(NULL));
|
ERR_FAIL_INDEX_V(index, _spells.size(), Ref<Spell>(NULL));
|
||||||
|
|
||||||
return _spells->get(index);
|
return _spells.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DataManager::get_spell_count() {
|
int DataManager::get_spell_count() {
|
||||||
return _spells->size();
|
return _spells.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataManager::add_spell(Ref<Spell> spell) {
|
void DataManager::add_spell(Ref<Spell> spell) {
|
||||||
ERR_FAIL_COND(!spell.is_valid());
|
ERR_FAIL_COND(!spell.is_valid());
|
||||||
|
|
||||||
_spells->push_back(spell);
|
_spells.push_back(spell);
|
||||||
_spell_map->set(spell->get_spell_id(), spell);
|
_spell_map.set(spell->get_spell_id(), spell);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataManager::add_aura(Ref<Aura> aura) {
|
void DataManager::add_aura(Ref<Aura> aura) {
|
||||||
ERR_FAIL_COND(!aura.is_valid());
|
ERR_FAIL_COND(!aura.is_valid());
|
||||||
|
|
||||||
_auras->push_back(aura);
|
_auras.push_back(aura);
|
||||||
_aura_map->set(aura->get_id(), aura);
|
_aura_map.set(aura->get_id(), aura);
|
||||||
|
}
|
||||||
|
|
||||||
|
String DataManager::get_auras_folder() {
|
||||||
|
return _auras_folder;
|
||||||
|
}
|
||||||
|
void DataManager::set_auras_folder(String folder) {
|
||||||
|
_auras_folder = folder;
|
||||||
|
}
|
||||||
|
Vector<Ref<Aura> > *DataManager::get_auras() {
|
||||||
|
return &_auras;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Aura> DataManager::get_aura(int aura_id) {
|
Ref<Aura> DataManager::get_aura(int aura_id) {
|
||||||
ERR_FAIL_COND_V(!_aura_map->has(aura_id), Ref<Aura>(NULL));
|
ERR_FAIL_COND_V(!_aura_map.has(aura_id), Ref<Aura>(NULL));
|
||||||
|
|
||||||
return _aura_map->get(aura_id);
|
return _aura_map.get(aura_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Aura> DataManager::get_aura_index(int index) {
|
Ref<Aura> DataManager::get_aura_index(int index) {
|
||||||
ERR_FAIL_INDEX_V(index, _auras->size(), Ref<Aura>(NULL));
|
ERR_FAIL_INDEX_V(index, _auras.size(), Ref<Aura>(NULL));
|
||||||
|
|
||||||
return _auras->get(index);
|
return _auras.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DataManager::get_aura_count() {
|
int DataManager::get_aura_count() {
|
||||||
return _auras->size();
|
return _auras.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataManager::add_craft_data(Ref<CraftDataAttribute> cda) {
|
void DataManager::add_craft_data(Ref<CraftDataAttribute> cda) {
|
||||||
ERR_FAIL_COND(!cda.is_valid());
|
ERR_FAIL_COND(!cda.is_valid());
|
||||||
|
|
||||||
_craft_datas->push_back(cda);
|
_craft_datas.push_back(cda);
|
||||||
_craft_data_map->set(cda->get_id(), cda);
|
_craft_data_map.set(cda->get_id(), cda);
|
||||||
|
}
|
||||||
|
|
||||||
|
String DataManager::get_craft_data_folder() {
|
||||||
|
return _craft_data_folder;
|
||||||
|
}
|
||||||
|
void DataManager::set_craft_data_folder(String folder) {
|
||||||
|
_craft_data_folder = folder;
|
||||||
|
}
|
||||||
|
Vector<Ref<CraftDataAttribute> > *DataManager::get_craft_datas() {
|
||||||
|
return &_craft_datas;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<CraftDataAttribute> DataManager::get_craft_data(int craft_id) {
|
Ref<CraftDataAttribute> DataManager::get_craft_data(int craft_id) {
|
||||||
ERR_FAIL_COND_V(!_craft_data_map->has(craft_id), Ref<CraftDataAttribute>(NULL));
|
ERR_FAIL_COND_V(!_craft_data_map.has(craft_id), Ref<CraftDataAttribute>(NULL));
|
||||||
|
|
||||||
return _craft_data_map->get(craft_id);
|
return _craft_data_map.get(craft_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<CraftDataAttribute> DataManager::get_craft_data_index(int index) {
|
Ref<CraftDataAttribute> DataManager::get_craft_data_index(int index) {
|
||||||
ERR_FAIL_INDEX_V(index, _craft_datas->size(), Ref<CraftDataAttribute>(NULL));
|
ERR_FAIL_INDEX_V(index, _craft_datas.size(), Ref<CraftDataAttribute>(NULL));
|
||||||
|
|
||||||
return _craft_datas->get(index);
|
return _craft_datas.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DataManager::get_craft_data_count() {
|
int DataManager::get_craft_data_count() {
|
||||||
return _craft_datas->size();
|
return _craft_datas.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
String DataManager::get_item_template_folder() {
|
||||||
|
return _item_template_folder;
|
||||||
|
}
|
||||||
|
void DataManager::set_item_template_folder(String folder) {
|
||||||
|
_item_template_folder = folder;
|
||||||
|
}
|
||||||
|
Vector<Ref<ItemTemplate> > *DataManager::get_item_templates() {
|
||||||
|
return &_item_templates;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataManager::add_item_template(Ref<ItemTemplate> cda) {
|
void DataManager::add_item_template(Ref<ItemTemplate> cda) {
|
||||||
ERR_FAIL_COND(!cda.is_valid());
|
ERR_FAIL_COND(!cda.is_valid());
|
||||||
|
|
||||||
_craft_datas->push_back(cda);
|
_craft_datas.push_back(cda);
|
||||||
_craft_data_map->set(cda->get_id(), cda);
|
_craft_data_map.set(cda->get_id(), cda);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<ItemTemplate> DataManager::get_item_template(int item_id) {
|
Ref<ItemTemplate> DataManager::get_item_template(int item_id) {
|
||||||
ERR_FAIL_COND_V(!_craft_data_map->has(item_id), Ref<ItemTemplate>(NULL));
|
ERR_FAIL_COND_V(!_craft_data_map.has(item_id), Ref<ItemTemplate>(NULL));
|
||||||
|
|
||||||
return _item_template_map->get(item_id);
|
return _item_template_map.get(item_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<ItemTemplate> DataManager::get_item_template_index(int index) {
|
Ref<ItemTemplate> DataManager::get_item_template_index(int index) {
|
||||||
ERR_FAIL_INDEX_V(index, _craft_datas->size(), Ref<ItemTemplate>(NULL));
|
ERR_FAIL_INDEX_V(index, _craft_datas.size(), Ref<ItemTemplate>(NULL));
|
||||||
|
|
||||||
return _item_templates->get(index);
|
return _item_templates.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DataManager::get_item_template_count() {
|
int DataManager::get_item_template_count() {
|
||||||
return _item_templates->size();
|
return _item_templates.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DataManager::load_all() {
|
void DataManager::load_all() {
|
||||||
load_spells();
|
load_spells();
|
||||||
load_auras();
|
load_auras();
|
||||||
@ -347,32 +397,32 @@ void DataManager::load_item_templates() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DataManager::list_characters() {
|
void DataManager::list_characters() {
|
||||||
for (int i = 0; i < _character_classes->size(); ++i) {
|
for (int i = 0; i < _character_classes.size(); ++i) {
|
||||||
print_error(itos(i) + ": " + _character_classes->get(i)->get_character_class_name());
|
print_error(itos(i) + ": " + _character_classes.get(i)->get_character_class_name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataManager::list_spells() {
|
void DataManager::list_spells() {
|
||||||
for (int i = 0; i < _spells->size(); ++i) {
|
for (int i = 0; i < _spells.size(); ++i) {
|
||||||
print_error(itos(i) + ": " + _spells->get(i)->get_spell_name());
|
print_error(itos(i) + ": " + _spells.get(i)->get_spell_name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataManager::list_auras() {
|
void DataManager::list_auras() {
|
||||||
for (int i = 0; i < _auras->size(); ++i) {
|
for (int i = 0; i < _auras.size(); ++i) {
|
||||||
print_error(itos(i) + ": " + _auras->get(i)->get_aura_name());
|
print_error(itos(i) + ": " + _auras.get(i)->get_aura_name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataManager::list_craft_data() {
|
void DataManager::list_craft_data() {
|
||||||
for (int i = 0; i < _craft_datas->size(); ++i) {
|
for (int i = 0; i < _craft_datas.size(); ++i) {
|
||||||
print_error(itos(i) + ": " + _craft_datas->get(i)->get_name());
|
print_error(itos(i) + ": " + _craft_datas.get(i)->get_name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataManager::list_item_templates() {
|
void DataManager::list_item_templates() {
|
||||||
for (int i = 0; i < _item_templates->size(); ++i) {
|
for (int i = 0; i < _item_templates.size(); ++i) {
|
||||||
print_error(itos(i) + ": " + _item_templates->get(i)->get_name());
|
print_error(itos(i) + ": " + _item_templates.get(i)->get_name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,50 +497,18 @@ void DataManager::_bind_methods() {
|
|||||||
DataManager::DataManager() {
|
DataManager::DataManager() {
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
_character_classes = memnew(Vector<Ref<CharacterClass> >());
|
|
||||||
_character_class_map = memnew(CharacterClassHashMap());
|
|
||||||
|
|
||||||
_spells = memnew(Vector<Ref<Spell> >());
|
|
||||||
_spell_map = memnew(SpellHashMap());
|
|
||||||
|
|
||||||
_auras = memnew(Vector<Ref<Aura> >());
|
|
||||||
_aura_map = memnew(AuraHashMap());
|
|
||||||
|
|
||||||
_craft_datas = memnew(Vector<Ref<CraftDataAttribute> >());
|
|
||||||
_craft_data_map = memnew(CraftDataHashMap());
|
|
||||||
|
|
||||||
_item_templates = memnew(Vector<Ref<ItemTemplate> >());
|
|
||||||
_item_template_map = memnew(ItemTemplateHashMap());
|
|
||||||
|
|
||||||
_automatic_load = true;
|
_automatic_load = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataManager::~DataManager() {
|
DataManager::~DataManager() {
|
||||||
instance = NULL;
|
instance = NULL;
|
||||||
|
|
||||||
_character_classes->clear();
|
_character_classes.clear();
|
||||||
_character_class_map->clear();
|
_character_class_map.clear();
|
||||||
_spells->clear();
|
_spells.clear();
|
||||||
_spell_map->clear();
|
_spell_map.clear();
|
||||||
_auras->clear();
|
_auras.clear();
|
||||||
_aura_map->clear();
|
_aura_map.clear();
|
||||||
_craft_datas->clear();
|
_craft_datas.clear();
|
||||||
_craft_data_map->clear();
|
_craft_data_map.clear();
|
||||||
//_spell_scripts->clear();
|
|
||||||
//_spell_script_map->clear();
|
|
||||||
|
|
||||||
memdelete(_character_classes);
|
|
||||||
memdelete(_character_class_map);
|
|
||||||
|
|
||||||
memdelete(_spells);
|
|
||||||
memdelete(_spell_map);
|
|
||||||
|
|
||||||
memdelete(_auras);
|
|
||||||
memdelete(_aura_map);
|
|
||||||
|
|
||||||
memdelete(_craft_datas);
|
|
||||||
memdelete(_craft_data_map);
|
|
||||||
|
|
||||||
memdelete(_item_templates);
|
|
||||||
memdelete(_item_template_map);
|
|
||||||
}
|
}
|
||||||
|
@ -19,54 +19,47 @@ class CharacterClass;
|
|||||||
class CraftDataAttribute;
|
class CraftDataAttribute;
|
||||||
class ItemTemplate;
|
class ItemTemplate;
|
||||||
|
|
||||||
typedef HashMap<int, Ref<CharacterClass> > CharacterClassHashMap;
|
|
||||||
typedef HashMap<int, Ref<Spell> > SpellHashMap;
|
|
||||||
typedef HashMap<int, Ref<Aura> > AuraHashMap;
|
|
||||||
typedef HashMap<int, Ref<CraftDataAttribute> > CraftDataHashMap;
|
|
||||||
typedef HashMap<int, Ref<ItemTemplate> > ItemTemplateHashMap;
|
|
||||||
//typedef HashMap<int, Ref<SpellScript> > SpellScriptHashMap;
|
|
||||||
|
|
||||||
class DataManager : public Node {
|
class DataManager : public Node {
|
||||||
GDCLASS(DataManager, Node);
|
GDCLASS(DataManager, Node);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static DataManager *get_instance();
|
static DataManager *get_instance();
|
||||||
|
|
||||||
String get_character_classes_folder() { return _character_classes_folder; }
|
String get_character_classes_folder();
|
||||||
void set_character_classes_folder(String folder) { _character_classes_folder = folder; }
|
void set_character_classes_folder(String folder);
|
||||||
Vector<Ref<CharacterClass> > *get_character_classes() { return _character_classes; }
|
Vector<Ref<CharacterClass> > *get_character_classes();
|
||||||
Ref<CharacterClass> get_character_class(int class_id);
|
Ref<CharacterClass> get_character_class(int class_id);
|
||||||
Ref<CharacterClass> get_character_class_index(int index);
|
Ref<CharacterClass> get_character_class_index(int index);
|
||||||
int get_character_class_count();
|
int get_character_class_count();
|
||||||
void add_character_class(Ref<CharacterClass> cls);
|
void add_character_class(Ref<CharacterClass> cls);
|
||||||
|
|
||||||
String get_spells_folder() { return _spells_folder; }
|
String get_spells_folder();
|
||||||
void set_spells_folder(String folder) { _spells_folder = folder; }
|
void set_spells_folder(String folder);
|
||||||
Vector<Ref<Spell> > *get_spells() { return _spells; }
|
Vector<Ref<Spell> > *get_spells();
|
||||||
Ref<Spell> get_spell(int spell_id);
|
Ref<Spell> get_spell(int spell_id);
|
||||||
Ref<Spell> get_spell_index(int index);
|
Ref<Spell> get_spell_index(int index);
|
||||||
int get_spell_count();
|
int get_spell_count();
|
||||||
void add_spell(Ref<Spell> spell);
|
void add_spell(Ref<Spell> spell);
|
||||||
|
|
||||||
String get_auras_folder() { return _auras_folder; }
|
String get_auras_folder();
|
||||||
void set_auras_folder(String folder) { _auras_folder = folder; }
|
void set_auras_folder(String folder);
|
||||||
Vector<Ref<Aura> > *get_auras() { return _auras; }
|
Vector<Ref<Aura> > *get_auras();
|
||||||
Ref<Aura> get_aura(int aura_id);
|
Ref<Aura> get_aura(int aura_id);
|
||||||
Ref<Aura> get_aura_index(int index);
|
Ref<Aura> get_aura_index(int index);
|
||||||
int get_aura_count();
|
int get_aura_count();
|
||||||
void add_aura(Ref<Aura> aura);
|
void add_aura(Ref<Aura> aura);
|
||||||
|
|
||||||
String get_craft_data_folder() { return _craft_data_folder; }
|
String get_craft_data_folder();
|
||||||
void set_craft_data_folder(String folder) { _craft_data_folder = folder; }
|
void set_craft_data_folder(String folder);
|
||||||
Vector<Ref<CraftDataAttribute> > *get_craft_datas() { return _craft_datas; }
|
Vector<Ref<CraftDataAttribute> > *get_craft_datas();
|
||||||
Ref<CraftDataAttribute> get_craft_data(int craft_id);
|
Ref<CraftDataAttribute> get_craft_data(int craft_id);
|
||||||
Ref<CraftDataAttribute> get_craft_data_index(int index);
|
Ref<CraftDataAttribute> get_craft_data_index(int index);
|
||||||
int get_craft_data_count();
|
int get_craft_data_count();
|
||||||
void add_craft_data(Ref<CraftDataAttribute> aura);
|
void add_craft_data(Ref<CraftDataAttribute> aura);
|
||||||
|
|
||||||
String get_item_template_folder() { return _item_template_folder; }
|
String get_item_template_folder();
|
||||||
void set_item_template_folder(String folder) { _item_template_folder = folder; }
|
void set_item_template_folder(String folder);
|
||||||
Vector<Ref<ItemTemplate> > *get_item_templates() { return _item_templates; }
|
Vector<Ref<ItemTemplate> > *get_item_templates();
|
||||||
void add_item_template(Ref<ItemTemplate> aura);
|
void add_item_template(Ref<ItemTemplate> aura);
|
||||||
Ref<ItemTemplate> get_item_template(int item_id);
|
Ref<ItemTemplate> get_item_template(int item_id);
|
||||||
Ref<ItemTemplate> get_item_template_index(int index);
|
Ref<ItemTemplate> get_item_template_index(int index);
|
||||||
@ -97,28 +90,24 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
String _character_classes_folder;
|
String _character_classes_folder;
|
||||||
Vector<Ref<CharacterClass> > *_character_classes;
|
Vector<Ref<CharacterClass> > _character_classes;
|
||||||
CharacterClassHashMap *_character_class_map;
|
HashMap<int, Ref<CharacterClass> > _character_class_map;
|
||||||
|
|
||||||
String _spells_folder;
|
String _spells_folder;
|
||||||
Vector<Ref<Spell> > *_spells;
|
Vector<Ref<Spell> > _spells;
|
||||||
SpellHashMap *_spell_map;
|
HashMap<int, Ref<Spell> > _spell_map;
|
||||||
|
|
||||||
String _auras_folder;
|
String _auras_folder;
|
||||||
Vector<Ref<Aura> > *_auras;
|
Vector<Ref<Aura> > _auras;
|
||||||
AuraHashMap *_aura_map;
|
HashMap<int, Ref<Aura> > _aura_map;
|
||||||
|
|
||||||
String _craft_data_folder;
|
String _craft_data_folder;
|
||||||
Vector<Ref<CraftDataAttribute> > *_craft_datas;
|
Vector<Ref<CraftDataAttribute> > _craft_datas;
|
||||||
CraftDataHashMap *_craft_data_map;
|
HashMap<int, Ref<CraftDataAttribute> > _craft_data_map;
|
||||||
|
|
||||||
String _item_template_folder;
|
String _item_template_folder;
|
||||||
Vector<Ref<ItemTemplate> > *_item_templates;
|
Vector<Ref<ItemTemplate> > _item_templates;
|
||||||
ItemTemplateHashMap *_item_template_map;
|
HashMap<int, Ref<ItemTemplate> > _item_template_map;
|
||||||
|
|
||||||
/*
|
|
||||||
Vector<Ref<SpellScript> > *_spell_scripts;
|
|
||||||
SpellScriptHashMap *_spell_script_map;*/
|
|
||||||
|
|
||||||
static DataManager *instance;
|
static DataManager *instance;
|
||||||
|
|
||||||
|
@ -1,73 +0,0 @@
|
|||||||
#include "icon.h"
|
|
||||||
|
|
||||||
int Icon::get_id() {
|
|
||||||
return _id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Icon::set_id(int value) {
|
|
||||||
_id = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
String Icon::get_icon_file_name() {
|
|
||||||
return _icon_file_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Icon::set_icon_file_name(String value) {
|
|
||||||
_icon_file_name = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector2i Icon::get_icon_atlas_position() {
|
|
||||||
return _icon_atlas_position;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Icon::set_icon_atlas_position(Vector2i value) {
|
|
||||||
_icon_atlas_position = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ref<Texture> Icon::get_icon() {
|
|
||||||
return _icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Icon::set_icon(Ref<Texture> value) {
|
|
||||||
_icon = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Icon::_bind_methods() {
|
|
||||||
ClassDB::bind_method(D_METHOD("get_id"), &Icon::get_id);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_id", "value"), &Icon::set_id);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_icon_file_name"), &Icon::get_icon_file_name);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_icon_file_name", "value"), &Icon::set_icon_file_name);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "icon_file_name"), "set_icon_file_name", "get_icon_file_name");
|
|
||||||
|
|
||||||
//ClassDB::bind_method(D_METHOD("get_icon_atlas_position"), &Icon::get_icon_atlas_position);
|
|
||||||
//ClassDB::bind_method(D_METHOD("set_icon_atlas_position", "value"), &Icon::set_icon_atlas_position);
|
|
||||||
//ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "icon_atlas_position"), "set_icon_atlas_position", "get_icon_atlas_position");
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_icon"), &Icon::get_icon);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_icon", "value"), &Icon::set_icon);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "icon_atlas_position", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_icon", "get_icon");
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("Load_icon"), &Icon::Load_icon);
|
|
||||||
ClassDB::bind_method(D_METHOD("is_icon_loaded"), &Icon::is_icon_loaded);
|
|
||||||
}
|
|
||||||
|
|
||||||
Icon::Icon() {
|
|
||||||
_id = 0;
|
|
||||||
_icon_file_name = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
Icon::Icon(int id, String icon_file_name, Vector2i icon_atlas_position) {
|
|
||||||
_id = id;
|
|
||||||
_icon_file_name = icon_file_name;
|
|
||||||
_icon_atlas_position = icon_atlas_position;
|
|
||||||
//_icon ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Rect* Icon::GetIconRect()
|
|
||||||
{
|
|
||||||
return new Rect((float)(iconAtlasPosition->x * 16), (float)(iconAtlasPosition->y * 16), (float)16, (float)16);
|
|
||||||
}
|
|
||||||
*/
|
|
41
data/icon.h
41
data/icon.h
@ -1,41 +0,0 @@
|
|||||||
#ifndef ICON_H
|
|
||||||
#define ICON_H
|
|
||||||
|
|
||||||
#include "core/resource.h"
|
|
||||||
#include "scene/resources/texture.h"
|
|
||||||
|
|
||||||
class Icon : public Resource {
|
|
||||||
GDCLASS(Icon, Resource)
|
|
||||||
|
|
||||||
public:
|
|
||||||
int get_id();
|
|
||||||
void set_id(int value);
|
|
||||||
|
|
||||||
String get_icon_file_name();
|
|
||||||
void set_icon_file_name(String value);
|
|
||||||
|
|
||||||
Vector2i get_icon_atlas_position();
|
|
||||||
void set_icon_atlas_position(Vector2i value);
|
|
||||||
|
|
||||||
Ref<Texture> get_icon();
|
|
||||||
void set_icon(Ref<Texture> value);
|
|
||||||
|
|
||||||
Icon();
|
|
||||||
Icon(int id, String _icon_file_name, Vector2i iconAtlasPosition);
|
|
||||||
|
|
||||||
void Load_icon() {}
|
|
||||||
//Rect *Get_icon_rect();
|
|
||||||
|
|
||||||
bool is_icon_loaded() { return _icon != nullptr; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
static void _bind_methods();
|
|
||||||
|
|
||||||
public:
|
|
||||||
int _id;
|
|
||||||
String _icon_file_name;
|
|
||||||
Vector2i _icon_atlas_position;
|
|
||||||
Ref<Texture> _icon;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -19,7 +19,6 @@ void ItemTemplate::set_name_key(String value) {
|
|||||||
_name_key = value;
|
_name_key = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ItemEnums::ItemType ItemTemplate::get_item_type() {
|
ItemEnums::ItemType ItemTemplate::get_item_type() {
|
||||||
return _item_type;
|
return _item_type;
|
||||||
}
|
}
|
||||||
@ -52,7 +51,6 @@ void ItemTemplate::set_rarity(int value) {
|
|||||||
_rarity = value;
|
_rarity = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ref<Texture> ItemTemplate::get_icon() {
|
Ref<Texture> ItemTemplate::get_icon() {
|
||||||
return _icon;
|
return _icon;
|
||||||
}
|
}
|
||||||
@ -61,7 +59,6 @@ void ItemTemplate::set_icon(Ref<Texture> value) {
|
|||||||
_icon = value;
|
_icon = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float ItemTemplate::get_scale_x() {
|
float ItemTemplate::get_scale_x() {
|
||||||
return _scale_x;
|
return _scale_x;
|
||||||
}
|
}
|
||||||
@ -86,7 +83,6 @@ void ItemTemplate::set_scale_z(float value) {
|
|||||||
_scale_z = value;
|
_scale_z = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ref<Spell> ItemTemplate::get_spell() {
|
Ref<Spell> ItemTemplate::get_spell() {
|
||||||
if (_spell)
|
if (_spell)
|
||||||
return (*_spell);
|
return (*_spell);
|
||||||
@ -101,7 +97,6 @@ void ItemTemplate::set_spell(Ref<Spell> spell) {
|
|||||||
_spell = memnew(Ref<Spell>(spell));
|
_spell = memnew(Ref<Spell>(spell));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ref<Aura> ItemTemplate::get_aura(int index) {
|
Ref<Aura> ItemTemplate::get_aura(int index) {
|
||||||
if (_auras[index])
|
if (_auras[index])
|
||||||
return (*_auras[index]);
|
return (*_auras[index]);
|
||||||
@ -116,7 +111,6 @@ void ItemTemplate::set_aura(int index, Ref<Aura> aura) {
|
|||||||
_auras[index] = memnew(Ref<Aura>(aura));
|
_auras[index] = memnew(Ref<Aura>(aura));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ItemTemplate::get_item_stat_modifier_count() {
|
int ItemTemplate::get_item_stat_modifier_count() {
|
||||||
return _modifier_count;
|
return _modifier_count;
|
||||||
}
|
}
|
||||||
@ -149,7 +143,6 @@ void ItemTemplate::set_item_max_base_mod(int index, float value) {
|
|||||||
_modifiers[index]->set_max_base_mod(value);
|
_modifiers[index]->set_max_base_mod(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float ItemTemplate::get_item_min_bonus_mod(int index) {
|
float ItemTemplate::get_item_min_bonus_mod(int index) {
|
||||||
return _modifiers[index]->get_min_bonus_mod();
|
return _modifiers[index]->get_min_bonus_mod();
|
||||||
}
|
}
|
||||||
@ -166,7 +159,6 @@ void ItemTemplate::set_item_max_bonus_mod(int index, float value) {
|
|||||||
_modifiers[index]->set_max_bonus_mod(value);
|
_modifiers[index]->set_max_bonus_mod(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float ItemTemplate::get_item_min_percent_mod(int index) {
|
float ItemTemplate::get_item_min_percent_mod(int index) {
|
||||||
return _modifiers[index]->get_min_percent_mod();
|
return _modifiers[index]->get_min_percent_mod();
|
||||||
}
|
}
|
||||||
@ -183,7 +175,6 @@ void ItemTemplate::set_item_max_percent_mod(int index, float value) {
|
|||||||
_modifiers[index]->set_max_percent_mod(value);
|
_modifiers[index]->set_max_percent_mod(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float ItemTemplate::get_item_scaling_factor(int index) {
|
float ItemTemplate::get_item_scaling_factor(int index) {
|
||||||
return _modifiers[index]->get_scaling_factor();
|
return _modifiers[index]->get_scaling_factor();
|
||||||
}
|
}
|
||||||
@ -200,7 +191,6 @@ void ItemTemplate::set_item_stat_modifier(int index, ItemStatModifier modifier)
|
|||||||
_modifiers[index] = modifier;
|
_modifiers[index] = modifier;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
int ItemTemplate::get_animator_weapon_type() {
|
int ItemTemplate::get_animator_weapon_type() {
|
||||||
if (_item_sub_type == ItemEnums::ITEM_SUB_TYPE_SWORD) {
|
if (_item_sub_type == ItemEnums::ITEM_SUB_TYPE_SWORD) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -214,6 +204,24 @@ int ItemTemplate::get_animator_weapon_type() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ref<ItemInstance> ItemTemplate::create_item_instance() {
|
||||||
|
if (has_method("_create_item_instance")) {
|
||||||
|
Ref<ItemInstance> ii = call("_create_item_instance");
|
||||||
|
|
||||||
|
ERR_FAIL_COND_V(!ii.is_valid(), Ref<ItemInstance>());
|
||||||
|
|
||||||
|
return ii;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ref<ItemInstance> item;
|
||||||
|
item.instance();
|
||||||
|
|
||||||
|
//todo setup
|
||||||
|
ERR_EXPLAIN("NOT YET IMPLEMENTED!");
|
||||||
|
ERR_FAIL_V(item);
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
ItemTemplate::ItemTemplate() {
|
ItemTemplate::ItemTemplate() {
|
||||||
_id = 0;
|
_id = 0;
|
||||||
@ -260,8 +268,10 @@ void ItemTemplate::_validate_property(PropertyInfo &property) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ItemTemplate::_bind_methods() {
|
void ItemTemplate::_bind_methods() {
|
||||||
|
BIND_VMETHOD(MethodInfo("_create_item_instance"));
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("create_item_instance"), &ItemTemplate::create_item_instance);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_id"), &ItemTemplate::get_id);
|
ClassDB::bind_method(D_METHOD("get_id"), &ItemTemplate::get_id);
|
||||||
ClassDB::bind_method(D_METHOD("set_id", "count"), &ItemTemplate::set_id);
|
ClassDB::bind_method(D_METHOD("set_id", "count"), &ItemTemplate::set_id);
|
||||||
@ -287,13 +297,10 @@ void ItemTemplate::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("set_rarity", "count"), &ItemTemplate::set_rarity);
|
ClassDB::bind_method(D_METHOD("set_rarity", "count"), &ItemTemplate::set_rarity);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "rarity", PROPERTY_HINT_FLAGS, ItemEnums::BINDING_STRING_RARITY), "set_rarity", "get_rarity");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "rarity", PROPERTY_HINT_FLAGS, ItemEnums::BINDING_STRING_RARITY), "set_rarity", "get_rarity");
|
||||||
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_icon"), &ItemTemplate::get_icon);
|
ClassDB::bind_method(D_METHOD("get_icon"), &ItemTemplate::get_icon);
|
||||||
ClassDB::bind_method(D_METHOD("set_icon", "value"), &ItemTemplate::set_icon);
|
ClassDB::bind_method(D_METHOD("set_icon", "value"), &ItemTemplate::set_icon);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_icon", "get_icon");
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_icon", "get_icon");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_scale_x"), &ItemTemplate::get_scale_x);
|
ClassDB::bind_method(D_METHOD("get_scale_x"), &ItemTemplate::get_scale_x);
|
||||||
ClassDB::bind_method(D_METHOD("set_scale_x", "count"), &ItemTemplate::set_scale_x);
|
ClassDB::bind_method(D_METHOD("set_scale_x", "count"), &ItemTemplate::set_scale_x);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "scale_x"), "set_scale_x", "get_scale_x");
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "scale_x"), "set_scale_x", "get_scale_x");
|
||||||
@ -306,7 +313,6 @@ void ItemTemplate::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("set_scale_z", "count"), &ItemTemplate::set_scale_z);
|
ClassDB::bind_method(D_METHOD("set_scale_z", "count"), &ItemTemplate::set_scale_z);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "scale_z"), "set_scale_z", "get_scale_z");
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "scale_z"), "set_scale_z", "get_scale_z");
|
||||||
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_spell"), &ItemTemplate::get_spell);
|
ClassDB::bind_method(D_METHOD("get_spell"), &ItemTemplate::get_spell);
|
||||||
ClassDB::bind_method(D_METHOD("set_spell", "spell"), &ItemTemplate::set_spell);
|
ClassDB::bind_method(D_METHOD("set_spell", "spell"), &ItemTemplate::set_spell);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "spell", PROPERTY_HINT_RESOURCE_TYPE, "Spell"), "set_spell", "get_spell");
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "spell", PROPERTY_HINT_RESOURCE_TYPE, "Spell"), "set_spell", "get_spell");
|
||||||
@ -332,44 +338,36 @@ void ItemTemplate::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("get_item_max_base_mod", "index"), &ItemTemplate::get_item_max_base_mod);
|
ClassDB::bind_method(D_METHOD("get_item_max_base_mod", "index"), &ItemTemplate::get_item_max_base_mod);
|
||||||
ClassDB::bind_method(D_METHOD("set_item_max_base_mod", "index", "value"), &ItemTemplate::set_item_max_base_mod);
|
ClassDB::bind_method(D_METHOD("set_item_max_base_mod", "index", "value"), &ItemTemplate::set_item_max_base_mod);
|
||||||
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_item_min_bonus_mod", "index"), &ItemTemplate::get_item_min_bonus_mod);
|
ClassDB::bind_method(D_METHOD("get_item_min_bonus_mod", "index"), &ItemTemplate::get_item_min_bonus_mod);
|
||||||
ClassDB::bind_method(D_METHOD("set_item_min_bonus_mod", "index", "value"), &ItemTemplate::set_item_min_bonus_mod);
|
ClassDB::bind_method(D_METHOD("set_item_min_bonus_mod", "index", "value"), &ItemTemplate::set_item_min_bonus_mod);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_item_max_bonus_mod", "index"), &ItemTemplate::get_item_max_bonus_mod);
|
ClassDB::bind_method(D_METHOD("get_item_max_bonus_mod", "index"), &ItemTemplate::get_item_max_bonus_mod);
|
||||||
ClassDB::bind_method(D_METHOD("set_item_max_bonus_mod", "index", "value"), &ItemTemplate::set_item_max_bonus_mod);
|
ClassDB::bind_method(D_METHOD("set_item_max_bonus_mod", "index", "value"), &ItemTemplate::set_item_max_bonus_mod);
|
||||||
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_item_min_percent_mod", "index"), &ItemTemplate::get_item_min_percent_mod);
|
ClassDB::bind_method(D_METHOD("get_item_min_percent_mod", "index"), &ItemTemplate::get_item_min_percent_mod);
|
||||||
ClassDB::bind_method(D_METHOD("set_item_min_percent_mod", "index", "value"), &ItemTemplate::set_item_min_percent_mod);
|
ClassDB::bind_method(D_METHOD("set_item_min_percent_mod", "index", "value"), &ItemTemplate::set_item_min_percent_mod);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_item_max_percent_mod", "index"), &ItemTemplate::get_item_max_percent_mod);
|
ClassDB::bind_method(D_METHOD("get_item_max_percent_mod", "index"), &ItemTemplate::get_item_max_percent_mod);
|
||||||
ClassDB::bind_method(D_METHOD("set_item_max_percent_mod", "index", "value"), &ItemTemplate::set_item_max_percent_mod);
|
ClassDB::bind_method(D_METHOD("set_item_max_percent_mod", "index", "value"), &ItemTemplate::set_item_max_percent_mod);
|
||||||
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_item_scaling_factor", "index"), &ItemTemplate::get_item_scaling_factor);
|
ClassDB::bind_method(D_METHOD("get_item_scaling_factor", "index"), &ItemTemplate::get_item_scaling_factor);
|
||||||
ClassDB::bind_method(D_METHOD("set_item_scaling_factor", "index", "value"), &ItemTemplate::set_item_scaling_factor);
|
ClassDB::bind_method(D_METHOD("set_item_scaling_factor", "index", "value"), &ItemTemplate::set_item_scaling_factor);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < MAX_ITEM_STAT_MOD; ++i) {
|
for (int i = 0; i < MAX_ITEM_STAT_MOD; ++i) {
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::INT, "Modifiers_" + itos(i) + "/stat_id", PROPERTY_HINT_ENUM, Stat::STAT_BINDING_STRING, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_item_stat_id", "get_item_stat_id", i);
|
ADD_PROPERTYI(PropertyInfo(Variant::INT, "Modifiers_" + itos(i) + "/stat_id", PROPERTY_HINT_ENUM, Stat::STAT_BINDING_STRING, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_item_stat_id", "get_item_stat_id", i);
|
||||||
|
|
||||||
|
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "Modifiers_" + itos(i) + "/min_base_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_item_min_base_mod", "get_item_min_base_mod", i);
|
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "Modifiers_" + itos(i) + "/min_base_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_item_min_base_mod", "get_item_min_base_mod", i);
|
||||||
|
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "Modifiers_" + itos(i) + "/max_base_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_item_max_base_mod", "get_item_max_base_mod", i);
|
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "Modifiers_" + itos(i) + "/max_base_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_item_max_base_mod", "get_item_max_base_mod", i);
|
||||||
|
|
||||||
|
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "Modifiers_" + itos(i) + "/min_bonus_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_item_min_bonus_mod", "get_item_min_bonus_mod", i);
|
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "Modifiers_" + itos(i) + "/min_bonus_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_item_min_bonus_mod", "get_item_min_bonus_mod", i);
|
||||||
|
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "Modifiers_" + itos(i) + "/max_bonus_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_item_max_bonus_mod", "get_item_max_bonus_mod", i);
|
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "Modifiers_" + itos(i) + "/max_bonus_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_item_max_bonus_mod", "get_item_max_bonus_mod", i);
|
||||||
|
|
||||||
|
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "Modifiers_" + itos(i) + "/min_percent_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_item_min_percent_mod", "get_item_min_percent_mod", i);
|
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "Modifiers_" + itos(i) + "/min_percent_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_item_min_percent_mod", "get_item_min_percent_mod", i);
|
||||||
|
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "Modifiers_" + itos(i) + "/max_percent_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_item_max_percent_mod", "get_item_max_percent_mod", i);
|
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "Modifiers_" + itos(i) + "/max_percent_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_item_max_percent_mod", "get_item_max_percent_mod", i);
|
||||||
|
|
||||||
|
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "Modifiers_" + itos(i) + "/scaling_factor", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_item_scaling_factor", "get_item_scaling_factor", i);
|
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "Modifiers_" + itos(i) + "/scaling_factor", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_item_scaling_factor", "get_item_scaling_factor", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,5 +375,4 @@ void ItemTemplate::_bind_methods() {
|
|||||||
//ClassDB::bind_method(D_METHOD("set_item_stat_modifier", "index", "value"), &ItemTemplate::set_item_stat_modifier);
|
//ClassDB::bind_method(D_METHOD("set_item_stat_modifier", "index", "value"), &ItemTemplate::set_item_stat_modifier);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_animator_weapon_type"), &ItemTemplate::get_animator_weapon_type);
|
ClassDB::bind_method(D_METHOD("get_animator_weapon_type"), &ItemTemplate::get_animator_weapon_type);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
#include "../entities/stats/stat.h"
|
#include "../entities/stats/stat.h"
|
||||||
#include "../item_enums.h"
|
#include "../item_enums.h"
|
||||||
|
|
||||||
|
#include "item_instance.h"
|
||||||
|
|
||||||
class Aura;
|
class Aura;
|
||||||
class Spell;
|
class Spell;
|
||||||
|
|
||||||
@ -83,6 +85,7 @@ public:
|
|||||||
|
|
||||||
int get_animator_weapon_type();
|
int get_animator_weapon_type();
|
||||||
|
|
||||||
|
Ref<ItemInstance> create_item_instance();
|
||||||
|
|
||||||
ItemTemplate();
|
ItemTemplate();
|
||||||
~ItemTemplate();
|
~ItemTemplate();
|
||||||
|
@ -96,6 +96,20 @@ void Spell::set_level(int value) {
|
|||||||
_level = value;
|
_level = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Spell::get_rank() {
|
||||||
|
return _rank;
|
||||||
|
}
|
||||||
|
void Spell::set_rank(int value) {
|
||||||
|
_rank = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ref<Spell> Spell::get_next_rank() {
|
||||||
|
return _next_rank;
|
||||||
|
}
|
||||||
|
void Spell::set_next_rank(Ref<Spell> value) {
|
||||||
|
_next_rank = value;
|
||||||
|
}
|
||||||
|
|
||||||
int Spell::get_item_cost() {
|
int Spell::get_item_cost() {
|
||||||
return _item_cost;
|
return _item_cost;
|
||||||
}
|
}
|
||||||
@ -359,6 +373,14 @@ void Spell::set_aoe_half_extents(Vector3 value) {
|
|||||||
bool Spell::has_effect_visual() {
|
bool Spell::has_effect_visual() {
|
||||||
return _effect_visual.is_valid();
|
return _effect_visual.is_valid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EntityEnums::CharacterSkeletonPoints Spell::get_effect_visual_point() {
|
||||||
|
return _effect_visual_point;
|
||||||
|
}
|
||||||
|
void Spell::set_effect_visual_point(EntityEnums::CharacterSkeletonPoints point) {
|
||||||
|
_effect_visual_point = point;
|
||||||
|
}
|
||||||
|
|
||||||
Ref<PackedScene> Spell::get_effect_visual() {
|
Ref<PackedScene> Spell::get_effect_visual() {
|
||||||
return _effect_visual;
|
return _effect_visual;
|
||||||
}
|
}
|
||||||
@ -369,6 +391,14 @@ void Spell::set_effect_visual(Ref<PackedScene> value) {
|
|||||||
bool Spell::has_spell_cast_finish_effect() {
|
bool Spell::has_spell_cast_finish_effect() {
|
||||||
return _spell_cast_finish_effect.is_valid();
|
return _spell_cast_finish_effect.is_valid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EntityEnums::CharacterSkeletonPoints Spell::get_spell_cast_finish_effect_point() {
|
||||||
|
return _spell_cast_finish_effect_point;
|
||||||
|
}
|
||||||
|
void Spell::set_spell_cast_finish_effect_point(EntityEnums::CharacterSkeletonPoints point) {
|
||||||
|
_spell_cast_finish_effect_point = point;
|
||||||
|
}
|
||||||
|
|
||||||
Ref<PackedScene> Spell::get_spell_cast_finish_effect() {
|
Ref<PackedScene> Spell::get_spell_cast_finish_effect() {
|
||||||
return _spell_cast_finish_effect;
|
return _spell_cast_finish_effect;
|
||||||
}
|
}
|
||||||
@ -852,6 +882,14 @@ void Spell::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("set_level", "value"), &Spell::set_level);
|
ClassDB::bind_method(D_METHOD("set_level", "value"), &Spell::set_level);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "level"), "set_level", "get_level");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "level"), "set_level", "get_level");
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_rank"), &Spell::get_rank);
|
||||||
|
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("get_is_local_spell"), &Spell::get_is_local_spell);
|
||||||
ClassDB::bind_method(D_METHOD("set_is_local_spell", "value"), &Spell::set_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");
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "is_local_spell"), "set_is_local_spell", "get_is_local_spell");
|
||||||
@ -1029,11 +1067,23 @@ void Spell::_bind_methods() {
|
|||||||
|
|
||||||
ADD_GROUP("Effect", "effect");
|
ADD_GROUP("Effect", "effect");
|
||||||
ClassDB::bind_method(D_METHOD("has_effect_visual"), &Spell::has_effect_visual);
|
ClassDB::bind_method(D_METHOD("has_effect_visual"), &Spell::has_effect_visual);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_effect_visual_point"), &Spell::get_effect_visual_point);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_effect_visual_point", "value"), &Spell::set_effect_visual_point);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "effect_visual_point", PROPERTY_HINT_ENUM, EntityEnums::BINDING_STRING_CHARCATER_SKELETON_POINTS), "set_effect_visual_point", "get_effect_visual_point");
|
||||||
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_effect_visual"), &Spell::get_effect_visual);
|
ClassDB::bind_method(D_METHOD("get_effect_visual"), &Spell::get_effect_visual);
|
||||||
ClassDB::bind_method(D_METHOD("set_effect_visual", "value"), &Spell::set_effect_visual);
|
ClassDB::bind_method(D_METHOD("set_effect_visual", "value"), &Spell::set_effect_visual);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "effect_visual", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "set_effect_visual", "get_effect_visual");
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "effect_visual", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "set_effect_visual", "get_effect_visual");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("has_spell_cast_finish_effect"), &Spell::has_spell_cast_finish_effect);
|
ClassDB::bind_method(D_METHOD("has_spell_cast_finish_effect"), &Spell::has_spell_cast_finish_effect);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_spell_cast_finish_effect_point"), &Spell::get_spell_cast_finish_effect_point);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_spell_cast_finish_effect_point", "value"), &Spell::set_spell_cast_finish_effect_point);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "spell_cast_finish_effect_point", PROPERTY_HINT_ENUM, EntityEnums::BINDING_STRING_CHARCATER_SKELETON_POINTS), "set_spell_cast_finish_effect_point", "get_spell_cast_finish_effect_point");
|
||||||
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_spell_cast_finish_effect"), &Spell::get_spell_cast_finish_effect);
|
ClassDB::bind_method(D_METHOD("get_spell_cast_finish_effect"), &Spell::get_spell_cast_finish_effect);
|
||||||
ClassDB::bind_method(D_METHOD("set_spell_cast_finish_effect", "value"), &Spell::set_spell_cast_finish_effect);
|
ClassDB::bind_method(D_METHOD("set_spell_cast_finish_effect", "value"), &Spell::set_spell_cast_finish_effect);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "effect_spell_cast_finish_effect", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "set_spell_cast_finish_effect", "get_spell_cast_finish_effect");
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "effect_spell_cast_finish_effect", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "set_spell_cast_finish_effect", "get_spell_cast_finish_effect");
|
||||||
|
37
data/spell.h
37
data/spell.h
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
#include "core/resource.h"
|
#include "core/resource.h"
|
||||||
#include "scene/resources/curve.h"
|
#include "scene/resources/curve.h"
|
||||||
#include "scene/resources/texture.h"
|
|
||||||
#include "scene/resources/packed_scene.h"
|
#include "scene/resources/packed_scene.h"
|
||||||
|
#include "scene/resources/texture.h"
|
||||||
|
|
||||||
#include "../entity_enums.h"
|
#include "../entity_enums.h"
|
||||||
#include "../spell_enums.h"
|
#include "../spell_enums.h"
|
||||||
@ -109,6 +109,12 @@ public:
|
|||||||
int get_level();
|
int get_level();
|
||||||
void set_level(int value);
|
void set_level(int value);
|
||||||
|
|
||||||
|
int get_rank();
|
||||||
|
void set_rank(int value);
|
||||||
|
|
||||||
|
Ref<Spell> get_next_rank();
|
||||||
|
void set_next_rank(Ref<Spell> value);
|
||||||
|
|
||||||
int get_item_cost();
|
int get_item_cost();
|
||||||
void set_item_cost(int value);
|
void set_item_cost(int value);
|
||||||
|
|
||||||
@ -219,10 +225,18 @@ public:
|
|||||||
void set_aoe_half_extents(Vector3 value);
|
void set_aoe_half_extents(Vector3 value);
|
||||||
|
|
||||||
bool has_effect_visual();
|
bool has_effect_visual();
|
||||||
|
|
||||||
|
EntityEnums::CharacterSkeletonPoints get_effect_visual_point();
|
||||||
|
void set_effect_visual_point(EntityEnums::CharacterSkeletonPoints point);
|
||||||
|
|
||||||
Ref<PackedScene> get_effect_visual();
|
Ref<PackedScene> get_effect_visual();
|
||||||
void set_effect_visual(Ref<PackedScene> value);
|
void set_effect_visual(Ref<PackedScene> value);
|
||||||
|
|
||||||
bool has_spell_cast_finish_effect();
|
bool has_spell_cast_finish_effect();
|
||||||
|
|
||||||
|
EntityEnums::CharacterSkeletonPoints get_spell_cast_finish_effect_point();
|
||||||
|
void set_spell_cast_finish_effect_point(EntityEnums::CharacterSkeletonPoints point);
|
||||||
|
|
||||||
Ref<PackedScene> get_spell_cast_finish_effect();
|
Ref<PackedScene> get_spell_cast_finish_effect();
|
||||||
void set_spell_cast_finish_effect(Ref<PackedScene> value);
|
void set_spell_cast_finish_effect(Ref<PackedScene> value);
|
||||||
|
|
||||||
@ -255,19 +269,6 @@ public:
|
|||||||
int get_spell_cooldown_mainpulation_data_count();
|
int get_spell_cooldown_mainpulation_data_count();
|
||||||
void set_spell_cooldown_mainpulation_data_count(int value);
|
void set_spell_cooldown_mainpulation_data_count(int value);
|
||||||
|
|
||||||
//AuraApplyData *getAuraApplyData() { return auraApplyData; }
|
|
||||||
//void setAuraApplyData(AuraApplyData *value) { auraApplyData = value; }
|
|
||||||
|
|
||||||
/*
|
|
||||||
void Set(int _spell_id, SpellType _spell_type, int p_damage_min, int _damage_max, bool _hideFrom_actionbar, float _cast_time,
|
|
||||||
float cooldown, int casterAuraApply, int casterAuraApply2, int targetAuraApply, int targetAuraApply2,
|
|
||||||
int level, int itemCost, int crafMaterialCost, int requiredItem, String *costTypeString, int costResource,
|
|
||||||
String *giveResourceTypeString, int giveResource, bool hasGlobalCooldown, bool isLocalSpell, String *iconBundle,
|
|
||||||
String *iconFile, Vector2i *iconAtlasPosition, String *nameKey, String *spellName, String *spellDescription);
|
|
||||||
|
|
||||||
void Set(bool needsTarget, bool canMoveWhileCasting);
|
|
||||||
*/
|
|
||||||
|
|
||||||
//// Spell Script ////
|
//// Spell Script ////
|
||||||
|
|
||||||
float PLAYER_HIT_RADIUS;
|
float PLAYER_HIT_RADIUS;
|
||||||
@ -365,13 +366,11 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int _spell_id;
|
int _spell_id;
|
||||||
|
|
||||||
int _spell_type;
|
int _spell_type;
|
||||||
|
|
||||||
bool _hide_from_actionbar;
|
bool _hide_from_actionbar;
|
||||||
float _cooldown;
|
float _cooldown;
|
||||||
SpellTargetType _target_type;
|
SpellTargetType _target_type;
|
||||||
//AuraApplyData *_aura_apply_data;
|
|
||||||
|
|
||||||
Ref<Aura> *_caster_aura_apply_ref;
|
Ref<Aura> *_caster_aura_apply_ref;
|
||||||
Ref<Aura> *_caster_aura_apply2_ref;
|
Ref<Aura> *_caster_aura_apply2_ref;
|
||||||
@ -384,6 +383,8 @@ private:
|
|||||||
Aura *_target_aura_apply2;
|
Aura *_target_aura_apply2;
|
||||||
|
|
||||||
int _level;
|
int _level;
|
||||||
|
int _rank;
|
||||||
|
Ref<Spell> _next_rank;
|
||||||
int _item_cost;
|
int _item_cost;
|
||||||
int _craft_material_cost;
|
int _craft_material_cost;
|
||||||
int _required_item;
|
int _required_item;
|
||||||
@ -427,8 +428,12 @@ private:
|
|||||||
SpellAOEColliderType _aoe_colliderType;
|
SpellAOEColliderType _aoe_colliderType;
|
||||||
Vector3 _aoe_half_extents;
|
Vector3 _aoe_half_extents;
|
||||||
|
|
||||||
|
EntityEnums::CharacterSkeletonPoints _effect_visual_point;
|
||||||
Ref<PackedScene> _effect_visual;
|
Ref<PackedScene> _effect_visual;
|
||||||
|
|
||||||
|
EntityEnums::CharacterSkeletonPoints _spell_cast_finish_effect_point;
|
||||||
Ref<PackedScene> _spell_cast_finish_effect;
|
Ref<PackedScene> _spell_cast_finish_effect;
|
||||||
|
|
||||||
Ref<PackedScene> _spell_cast_effect;
|
Ref<PackedScene> _spell_cast_effect;
|
||||||
|
|
||||||
Ref<PackedScene> _projectile;
|
Ref<PackedScene> _projectile;
|
||||||
|
@ -1467,69 +1467,19 @@ void Entity::setc_target(Node *p_target) {
|
|||||||
//// TalentCOmponent ////
|
//// TalentCOmponent ////
|
||||||
|
|
||||||
void Entity::csend_request_rank_increase(int talentID) {
|
void Entity::csend_request_rank_increase(int talentID) {
|
||||||
/*
|
|
||||||
if (CxNet::IsServer) {
|
|
||||||
CSendRequestRankIncreaseMsg cSendRequestRankIncreaseMsg = CSendRequestRankIncreaseMsg();
|
|
||||||
cSendRequestRankIncreaseMsg.Guid = owner->PlayerData->GUID;
|
|
||||||
cSendRequestRankIncreaseMsg.TalentId = talentID;
|
|
||||||
cSendRequestRankIncreaseMsg.Serialize(CxNet::NetBuffer);
|
|
||||||
CxNet::SendBufferToAllClients(0);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::csend_request_rank_decrease(int talentID) {
|
void Entity::csend_request_rank_decrease(int talentID) {
|
||||||
/*
|
|
||||||
if (CxNet::IsServer) {
|
|
||||||
CSendRequestRankDecreaseMsg cSendRequestRankDecreaseMsg = CSendRequestRankDecreaseMsg();
|
|
||||||
cSendRequestRankDecreaseMsg.Guid = owner->PlayerData->GUID;
|
|
||||||
cSendRequestRankDecreaseMsg.TalentId = talentID;
|
|
||||||
cSendRequestRankDecreaseMsg.Serialize(CxNet::NetBuffer);
|
|
||||||
CxNet::SendBufferToAllClients(0);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::ssend_rank(int talentID, int rank) {
|
void Entity::ssend_rank(int talentID, int rank) {
|
||||||
/*
|
|
||||||
if (CxNet::IsServer) {
|
|
||||||
SSendRankValueMsg sSendRankValueMsg = SSendRankValueMsg();
|
|
||||||
sSendRankValueMsg.Guid = owner->PlayerData->GUID;
|
|
||||||
sSendRankValueMsg.TalentId = talentID;
|
|
||||||
sSendRankValueMsg.Rank = rank;
|
|
||||||
sSendRankValueMsg.Serialize(CxNet::NetBuffer);
|
|
||||||
CxNet::SendBufferToAllClients(0);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::sreceive_rank_increase(int talentID) {
|
void Entity::sreceive_rank_increase(int talentID) {
|
||||||
/*
|
|
||||||
PlayerTalent *playerTalent = SGetTalent(talentID, true);
|
|
||||||
if (owner->PlayerData->Character == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Talent *talent = Talents::Instance->GetData(talentID);
|
|
||||||
if (talent == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (talent->MaxRank >= playerTalent->getRank()) {
|
|
||||||
PlayerTalent *expr_47 = playerTalent;
|
|
||||||
int rank = expr_47->getRank();
|
|
||||||
expr_47->setRank(rank + 1);
|
|
||||||
SSendRank(talentID, playerTalent->getRank());
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::sreceive_rank_decrease(int talentID) {
|
void Entity::sreceive_rank_decrease(int talentID) {
|
||||||
/*
|
|
||||||
PlayerTalent *playerTalent = SGetTalent(talentID, false);
|
|
||||||
if (playerTalent == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (playerTalent->getRank() > 0) {
|
|
||||||
PlayerTalent *expr_17 = playerTalent;
|
|
||||||
int rank = expr_17->getRank();
|
|
||||||
expr_17->setRank(rank - 1);
|
|
||||||
SSendRank(talentID, playerTalent->getRank());
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::creceive_rank(int talentID, int rank) {
|
void Entity::creceive_rank(int talentID, int rank) {
|
||||||
@ -1600,426 +1550,54 @@ Ref<Bag> Entity::getc_bag(int index) {
|
|||||||
return _c_bags[index];
|
return _c_bags[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::sadd_craft_material(int itemId, int count) {
|
|
||||||
/*
|
|
||||||
for (int i = 0; i < sCraftMaterialInventory->Count; i += 1) {
|
|
||||||
ItemInstance *itemInstance = sCraftMaterialInventory->GetData(i);
|
|
||||||
if (itemInstance->getItemID() == itemId) {
|
|
||||||
ItemInstance *expr_1B = itemInstance;
|
|
||||||
expr_1B->setCount(count);
|
|
||||||
SSendAddCraftMaterial(itemId, count);
|
|
||||||
if (SOnCraftMaterialAdded != null) {
|
|
||||||
DELEGATE_INVOKE(SOnCraftMaterialAdded, itemInstance);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ItemInstance *itemInstance2 = new ItemInstance(itemId, count);
|
|
||||||
sCraftMaterialInventory->Add(itemInstance2);
|
|
||||||
SSendAddCraftMaterial(itemId, count);
|
|
||||||
if (SOnCraftMaterialAdded != null) {
|
|
||||||
DELEGATE_INVOKE(SOnCraftMaterialAdded, itemInstance2);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void Entity::sremove_craft_material(int itemId, int count) {
|
|
||||||
/*
|
|
||||||
for (int i = 0; i < sCraftMaterialInventory->Count; i += 1) {
|
|
||||||
ItemInstance *itemInstance = sCraftMaterialInventory->GetData(i);
|
|
||||||
if (itemInstance->getItemID() == itemId) {
|
|
||||||
ItemInstance *expr_21 = itemInstance;
|
|
||||||
expr_21->setCount(count);
|
|
||||||
if (itemInstance->getCount() <= 0) {
|
|
||||||
if (itemInstance->getCount() < 0) {
|
|
||||||
Array<Object> *expr_46 = new Array<Object>(4);
|
|
||||||
expr_46->SetData(0, new String("inventory->SRemoveCraftMaterial: Material count was less than 0. Itemid="));
|
|
||||||
expr_46->SetData(1, BOX<int>(itemId));
|
|
||||||
expr_46->SetData(2, new String(" player="));
|
|
||||||
expr_46->SetData(3, owner->gameObject->name);
|
|
||||||
Debug::Log(String::Concat(expr_46));
|
|
||||||
}
|
|
||||||
sCraftMaterialInventory->RemoveAt(i);
|
|
||||||
}
|
|
||||||
SSendRemoveCraftMaterial(itemId, count);
|
|
||||||
if (SOnCraftMaterialRemoved != null) {
|
|
||||||
DELEGATE_INVOKE(SOnCraftMaterialRemoved);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Array<Object> *expr_BF = new Array<Object>(4);
|
|
||||||
expr_BF->SetData(0, new String("inventory->SRemoveCraftMaterial: Material didn't exist in player's inventory. Itemid="));
|
|
||||||
expr_BF->SetData(1, BOX<int>(itemId));
|
|
||||||
expr_BF->SetData(2, new String(" player="));
|
|
||||||
expr_BF->SetData(3, owner->gameObject->name);
|
|
||||||
Debug::Log(String::Concat(expr_BF));*/
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Entity::stry_to_add_item(int itemId, int count) {
|
bool Entity::stry_to_add_item(int itemId, int count) {
|
||||||
/*
|
|
||||||
int num = -1;
|
|
||||||
for (int i = 0; i < getSInventory()->Count; i += 1) {
|
|
||||||
ItemInstance *itemInstance = getSInventory()->GetData(i);
|
|
||||||
if (itemInstance == null) {
|
|
||||||
if (num == -1) {
|
|
||||||
num = i;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (itemInstance->getItemID() == itemId) {
|
|
||||||
ItemInstance *expr_28 = itemInstance;
|
|
||||||
expr_28->setCount(count);
|
|
||||||
SSendAddItem(i, itemId, count);
|
|
||||||
if (SOnItemAdded != null) {
|
|
||||||
DELEGATE_INVOKE(SOnItemAdded, itemInstance);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (num == -1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ItemInstance *itemInstance2 = new ItemInstance(itemId, count);
|
|
||||||
getSInventory()->SetData(num, itemInstance2);
|
|
||||||
SSendAddItem(num, itemId, count);
|
|
||||||
if (SOnItemAdded != null) {
|
|
||||||
DELEGATE_INVOKE(SOnItemAdded, itemInstance2);
|
|
||||||
}
|
|
||||||
return true;*/
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Entity::stry_to_remove_item(int itemId, int count) {
|
bool Entity::stry_to_remove_item(int itemId, int count) {
|
||||||
/*
|
|
||||||
int i = 0;
|
|
||||||
while (i < getSInventory()->Count) {
|
|
||||||
ItemInstance *itemInstance = getSInventory()->GetData(i);
|
|
||||||
if ((itemInstance != null) && (itemInstance->getItemID() == itemId)) {
|
|
||||||
if (itemInstance->getCount() < count) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (itemInstance->getCount() == count) {
|
|
||||||
getSInventory()->SetData(i, null);
|
|
||||||
if (SOnItemRemoved != null) {
|
|
||||||
DELEGATE_INVOKE(SOnItemRemoved);
|
|
||||||
}
|
|
||||||
SSendRemoveItem(i);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
ItemInstance *expr_5E = itemInstance;
|
|
||||||
expr_5E->setCount(count);
|
|
||||||
SSendChangeItemCount(i, itemInstance->getCount());
|
|
||||||
if (SOnItemCountChanged != null) {
|
|
||||||
DELEGATE_INVOKE(SOnItemCountChanged, itemInstance);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
i += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;*/
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::ssend_add_item(int slotId, int itemId, int count) {
|
void Entity::ssend_add_item(int slotId, int itemId, int count) {
|
||||||
/*
|
|
||||||
if (CxNet::IsServer && (owner->Connection != null)) {
|
|
||||||
SSendAddItemMsg sSendAddItemMsg = SSendAddItemMsg();
|
|
||||||
sSendAddItemMsg.SlotId = slotId;
|
|
||||||
sSendAddItemMsg.ItemId = itemId;
|
|
||||||
sSendAddItemMsg.Count = count;
|
|
||||||
sSendAddItemMsg.Serialize(CxNet::NetBuffer);
|
|
||||||
owner->Connection->SendBuffer(0, CxNet::NetBuffer);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::ssend_change_item_count(int slotId, int count) {
|
void Entity::ssend_change_item_count(int slotId, int count) {
|
||||||
/*
|
|
||||||
if (CxNet::IsServer && (owner->Connection != null)) {
|
|
||||||
SSendChangeItemCountMsg sSendChangeItemCountMsg = SSendChangeItemCountMsg();
|
|
||||||
sSendChangeItemCountMsg.SlotId = slotId;
|
|
||||||
sSendChangeItemCountMsg.Count = count;
|
|
||||||
sSendChangeItemCountMsg.Serialize(CxNet::NetBuffer);
|
|
||||||
owner->Connection->SendBuffer(0, CxNet::NetBuffer);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::ssend_remove_item(int slotId) {
|
void Entity::ssend_remove_item(int slotId) {
|
||||||
/*
|
|
||||||
if (CxNet::IsServer && (owner->Connection != null)) {
|
|
||||||
SSendRemoveItemMsg sSendRemoveItemMsg = SSendRemoveItemMsg();
|
|
||||||
sSendRemoveItemMsg.SlotId = slotId;
|
|
||||||
sSendRemoveItemMsg.Serialize(CxNet::NetBuffer);
|
|
||||||
owner->Connection->SendBuffer(0, CxNet::NetBuffer);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::ssend_move_item(int slot1, int slot2) {
|
void Entity::ssend_move_item(int slot1, int slot2) {
|
||||||
/*
|
|
||||||
if (CxNet::IsServer && (owner->Connection != null)) {
|
|
||||||
SSendMoveItemMsg sSendMoveItemMsg = SSendMoveItemMsg();
|
|
||||||
sSendMoveItemMsg.Slot1 = slot1;
|
|
||||||
sSendMoveItemMsg.Slot2 = slot2;
|
|
||||||
sSendMoveItemMsg.Serialize(CxNet::NetBuffer);
|
|
||||||
owner->Connection->SendBuffer(0, CxNet::NetBuffer);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::ssend_sent_items(String items) {
|
void Entity::ssend_sent_items(String items) {
|
||||||
/*
|
|
||||||
if (CxNet::IsServer && (owner->Connection != null)) {
|
|
||||||
SSendSentItemsMsg sSendSentItemsMsg = SSendSentItemsMsg();
|
|
||||||
sSendSentItemsMsg.Items = items;
|
|
||||||
sSendSentItemsMsg.Serialize(CxNet::NetBuffer);
|
|
||||||
owner->Connection->SendBuffer(0, CxNet::NetBuffer);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::csend_swap_items(int slot1, int slot2) {
|
void Entity::csend_swap_items(int slot1, int slot2) {
|
||||||
/*
|
|
||||||
if (CxNet::IsServer && (owner->Connection != null)) {
|
|
||||||
CSendSwapItemsMsg cSendSwapItemsMsg = CSendSwapItemsMsg();
|
|
||||||
cSendSwapItemsMsg.Slot1 = slot1;
|
|
||||||
cSendSwapItemsMsg.Slot2 = slot2;
|
|
||||||
cSendSwapItemsMsg.Serialize(CxNet::NetBuffer);
|
|
||||||
CxNet::SendBufferToServer(0);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::csend_craft_item_request(int craftId) {
|
void Entity::csend_craft_item_request(int craftId) {
|
||||||
/*
|
|
||||||
if (CxNet::IsServer && (owner->Connection != null)) {
|
|
||||||
CSendCraftItemRequestMsg cSendCraftItemRequestMsg = CSendCraftItemRequestMsg();
|
|
||||||
cSendCraftItemRequestMsg.CraftId = craftId;
|
|
||||||
cSendCraftItemRequestMsg.Serialize(CxNet::NetBuffer);
|
|
||||||
CxNet::SendBufferToServer(0);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void Entity::ssend_add_craft_material(int itemId, int count) {
|
|
||||||
/*
|
|
||||||
if (CxNet::IsServer && (owner->Connection != null)) {
|
|
||||||
SSendAddCraftMaterialMsg sSendAddCraftMaterialMsg = SSendAddCraftMaterialMsg();
|
|
||||||
sSendAddCraftMaterialMsg.ItemId = itemId;
|
|
||||||
sSendAddCraftMaterialMsg.Count = count;
|
|
||||||
sSendAddCraftMaterialMsg.Serialize(CxNet::NetBuffer);
|
|
||||||
owner->Connection->SendBuffer(0, CxNet::NetBuffer);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void Entity::ssend_remove_craft_material(int itemId, int count) {
|
|
||||||
/*
|
|
||||||
if (CxNet::IsServer && (owner->Connection != null)) {
|
|
||||||
SSendRemoveCraftMaterialMsg sSendRemoveCraftMaterialMsg = SSendRemoveCraftMaterialMsg();
|
|
||||||
sSendRemoveCraftMaterialMsg.ItemId = itemId;
|
|
||||||
sSendRemoveCraftMaterialMsg.Count = count;
|
|
||||||
sSendRemoveCraftMaterialMsg.Serialize(CxNet::NetBuffer);
|
|
||||||
owner->Connection->SendBuffer(0, CxNet::NetBuffer);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void Entity::ssend_sent_craft_materials(String materials) {
|
|
||||||
/*
|
|
||||||
if (CxNet::IsServer && (owner->Connection != null)) {
|
|
||||||
SSendSentCraftMaterialsMsg sSendSentCraftMaterialsMsg = SSendSentCraftMaterialsMsg();
|
|
||||||
sSendSentCraftMaterialsMsg.Materials = materials;
|
|
||||||
sSendSentCraftMaterialsMsg.Serialize(CxNet::NetBuffer);
|
|
||||||
owner->Connection->SendBuffer(0, CxNet::NetBuffer);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::creceive_add_item(int slotId, int itemId, int count) {
|
void Entity::creceive_add_item(int slotId, int itemId, int count) {
|
||||||
/*
|
|
||||||
if (getCInventory()->GetData(slotId) == null) {
|
|
||||||
getCInventory()->SetData(slotId, new ItemInstance(itemId, count));
|
|
||||||
} else {
|
|
||||||
if (getCInventory()->GetData(slotId)->ItemID != itemId) {
|
|
||||||
Array<Object> *expr_40 = new Array<Object>(6);
|
|
||||||
expr_40->SetData(0, new String("Item did not match in slot "));
|
|
||||||
expr_40->SetData(1, BOX<int>(slotId));
|
|
||||||
expr_40->SetData(2, new String(" "));
|
|
||||||
expr_40->SetData(3, BOX<int>(itemId));
|
|
||||||
expr_40->SetData(4, new String(" orig id: "));
|
|
||||||
expr_40->SetData(5, BOX<int>(getCInventory()->GetData(slotId)->ItemID));
|
|
||||||
Debug::Log(String::Concat(expr_40));
|
|
||||||
getCInventory()->GetData(slotId)->ItemID = itemId;
|
|
||||||
}
|
|
||||||
ItemInstance *expr_AB = getCInventory()->GetData(slotId);
|
|
||||||
expr_AB->setCount(count);
|
|
||||||
}
|
|
||||||
if (COnItemAdded != null) {
|
|
||||||
DELEGATE_INVOKE(COnItemAdded, getCInventory()->GetData(slotId));
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::creceive_change_item_count(int slotId, int count) {
|
void Entity::creceive_change_item_count(int slotId, int count) {
|
||||||
/*
|
|
||||||
if (getCInventory()->GetData(slotId) == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
getCInventory()->GetData(slotId)->ItemID = count;
|
|
||||||
if (COnItemCountChanged != null) {
|
|
||||||
DELEGATE_INVOKE(COnItemCountChanged, getCInventory()->GetData(slotId));
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::creceive_remove_item(int slotId) {
|
void Entity::creceive_remove_item(int slotId) {
|
||||||
/*
|
|
||||||
getCInventory()->SetData(slotId, null);
|
|
||||||
if (COnItemRemoved != null) {
|
|
||||||
DELEGATE_INVOKE(COnItemRemoved);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::creceive_move_item(int slot1, int slot2) {
|
void Entity::creceive_move_item(int slot1, int slot2) {
|
||||||
/*
|
|
||||||
if ((slot1 >= getCInventory()->Count) || (slot2 >= getCInventory()->Count)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((getCInventory()->GetData(slot1) == null) && (getCInventory()->GetData(slot2) == null)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ItemInstance *value = getCInventory()->GetData(slot1);
|
|
||||||
getCInventory()->SetData(slot1, getCInventory()->GetData(slot2));
|
|
||||||
getCInventory()->SetData(slot2, value);
|
|
||||||
if (COnItemMoved != null) {
|
|
||||||
DELEGATE_INVOKE(COnItemMoved);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void Entity::creceive_add_craft_material(int itemId, int count) {
|
|
||||||
/*
|
|
||||||
for (int i = 0; i < cCraftMaterialInventory->Count; i += 1) {
|
|
||||||
ItemInstance *itemInstance = cCraftMaterialInventory->GetData(i);
|
|
||||||
if (itemInstance->getItemID() == itemId) {
|
|
||||||
ItemInstance *expr_1B = itemInstance;
|
|
||||||
expr_1B->setCount(count);
|
|
||||||
if (COnCraftMaterialAdded != null) {
|
|
||||||
DELEGATE_INVOKE(COnCraftMaterialAdded, itemInstance);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ItemInstance *itemInstance2 = new ItemInstance(itemId, count);
|
|
||||||
cCraftMaterialInventory->Add(itemInstance2);
|
|
||||||
if (COnCraftMaterialAdded != null) {
|
|
||||||
DELEGATE_INVOKE(COnCraftMaterialAdded, itemInstance2);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void Entity::creceive_remove_craft_material(int itemId, int count) {
|
|
||||||
/*
|
|
||||||
for (int i = 0; i < getCCraftMaterialInventory()->Count; i += 1) {
|
|
||||||
ItemInstance *itemInstance = getCCraftMaterialInventory()->GetData(i);
|
|
||||||
if (itemInstance->getItemID() == itemId) {
|
|
||||||
ItemInstance *expr_1B = itemInstance;
|
|
||||||
expr_1B->setCount(count);
|
|
||||||
if (itemInstance->getCount() <= 0) {
|
|
||||||
getCCraftMaterialInventory()->RemoveAt(i);
|
|
||||||
}
|
|
||||||
if (COnCraftMaterialRemoved != null) {
|
|
||||||
DELEGATE_INVOKE(COnCraftMaterialRemoved);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void Entity::creceive_sent_craft_materials(String materials) {
|
|
||||||
/*
|
|
||||||
Array<char> *expr_07 = new Array<char>(1);
|
|
||||||
expr_07->SetData(0, ';');
|
|
||||||
Array<String> *array = materials->Split(expr_07);
|
|
||||||
for (int i = 0; i < (array->Length - 1); i += 1) {
|
|
||||||
String arg_24_0 = array->GetData(i);
|
|
||||||
Array<char> *expr_1F = new Array<char>(1);
|
|
||||||
expr_1F->SetData(0, '=');
|
|
||||||
Array<String> *array2 = arg_24_0->Split(expr_1F);
|
|
||||||
ItemInstance *item = new ItemInstance(BSConvert::ToInt(array2->GetData(0)), BSConvert::ToInt(array2->GetData(1)));
|
|
||||||
getCCraftMaterialInventory()->Add(item);
|
|
||||||
}
|
|
||||||
if (COnCraftMaterialsLoaded != null) {
|
|
||||||
DELEGATE_INVOKE(COnCraftMaterialsLoaded);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::creceive_sent_items(String items) {
|
void Entity::creceive_sent_items(String items) {
|
||||||
/*
|
|
||||||
Array<char> *expr_07 = new Array<char>(1);
|
|
||||||
expr_07->SetData(0, ';');
|
|
||||||
Array<String> *array = items->Split(expr_07);
|
|
||||||
for (int i = 0; i < (array->Length - 1); i += 1) {
|
|
||||||
String arg_24_0 = array->GetData(i);
|
|
||||||
Array<char> *expr_1F = new Array<char>(1);
|
|
||||||
expr_1F->SetData(0, '=');
|
|
||||||
Array<String> *array2 = arg_24_0->Split(expr_1F);
|
|
||||||
ItemInstance *value = new ItemInstance(BSConvert::ToInt(array2->GetData(1)), BSConvert::ToInt(array2->GetData(2)));
|
|
||||||
getCInventory()->SetData(BSConvert::ToInt(array2->GetData(0)), value);
|
|
||||||
}
|
|
||||||
if (COnItemsLoaded != null) {
|
|
||||||
DELEGATE_INVOKE(COnItemsLoaded);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::sreceive_swap_items(int slot1, int slot2) {
|
void Entity::sreceive_swap_items(int slot1, int slot2) {
|
||||||
/*
|
|
||||||
if ((slot1 >= getSInventory()->Count) || (slot2 >= getSInventory()->Count)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((getSInventory()->GetData(slot1) == null) && (getSInventory()->GetData(slot2) == null)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ItemInstance *value = getSInventory()->GetData(slot1);
|
|
||||||
getSInventory()->SetData(slot1, getSInventory()->GetData(slot2));
|
|
||||||
getSInventory()->SetData(slot2, value);
|
|
||||||
SSendMoveItem(slot1, slot2);
|
|
||||||
if (SOnItemMoved != null) {
|
|
||||||
DELEGATE_INVOKE(SOnItemMoved);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::send_all_items() {
|
void Entity::send_all_items() {
|
||||||
/*
|
|
||||||
StringBuilder *StringBuilder = new StringBuilder();
|
|
||||||
for (int i = 0; i < getSCraftMaterialInventory()->Count; i += 1) {
|
|
||||||
StringBuilder->Append(getSCraftMaterialInventory()->GetData(i)->ItemID);
|
|
||||||
StringBuilder->Append('=');
|
|
||||||
StringBuilder->Append(getSCraftMaterialInventory()->GetData(i)->Count);
|
|
||||||
StringBuilder->Append(';');
|
|
||||||
if (StringBuilder->Length >= 700) {
|
|
||||||
SSendSentCraftMaterials(StringBuilder->ToString());
|
|
||||||
StringBuilder->Remove(0, StringBuilder->Length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SSendSentCraftMaterials(StringBuilder->ToString());
|
|
||||||
if (StringBuilder->Length > 0) {
|
|
||||||
StringBuilder->Remove(0, StringBuilder->Length);
|
|
||||||
}
|
|
||||||
for (int j = 0; j < getSInventory()->Count; j += 1) {
|
|
||||||
if (getSInventory()->GetData(j) != null) {
|
|
||||||
StringBuilder->Append(j);
|
|
||||||
StringBuilder->Append('=');
|
|
||||||
StringBuilder->Append(getSInventory()->GetData(j)->ItemID);
|
|
||||||
StringBuilder->Append('=');
|
|
||||||
StringBuilder->Append(getSInventory()->GetData(j)->Count);
|
|
||||||
StringBuilder->Append(';');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SSendSentItems(StringBuilder->ToString());*/
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Entity::shas_craft_material(int itemId, int count) {
|
|
||||||
/*
|
|
||||||
for (int i = 0; i < getSCraftMaterialInventory()->Count; i += 1) {
|
|
||||||
if ((getSCraftMaterialInventory()->GetData(i)->ItemID == itemId) && (getSCraftMaterialInventory()->GetData(i)->Count >= count)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;*/
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Entity::shas_item(int itemId, int count) {
|
bool Entity::shas_item(int itemId, int count) {
|
||||||
@ -2034,18 +1612,6 @@ bool Entity::shas_item(int itemId, int count) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Entity::chas_craft_material(int itemId, int count) {
|
|
||||||
/*
|
|
||||||
for (int i = 0; i < getCCraftMaterialInventory()->Count; i += 1) {
|
|
||||||
if ((getCCraftMaterialInventory()->GetData(i)->ItemID == itemId) && (getCCraftMaterialInventory()->GetData(i)->Count >= count)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;*/
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Entity::chas_item(int itemId, int count) {
|
bool Entity::chas_item(int itemId, int count) {
|
||||||
/*
|
/*
|
||||||
for (int i = 0; i < getCInventory()->Count; i += 1) {
|
for (int i = 0; i < getCInventory()->Count; i += 1) {
|
||||||
@ -2059,136 +1625,32 @@ bool Entity::chas_item(int itemId, int count) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Entity::cget_item_count(int itemId) {
|
int Entity::cget_item_count(int itemId) {
|
||||||
/*
|
|
||||||
for (int i = 0; i < getCInventory()->Count; i += 1) {
|
|
||||||
if ((getCInventory()->GetData(i) != null) && (getCInventory()->GetData(i)->ItemID == itemId)) {
|
|
||||||
return getCInventory()->GetData(i)->Count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;*/
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Entity::sget_item_count(int itemId) {
|
int Entity::sget_item_count(int itemId) {
|
||||||
/*
|
|
||||||
for (int i = 0; i < getSInventory()->Count; i += 1) {
|
|
||||||
if ((getSInventory()->GetData(i) != null) && (getSInventory()->GetData(i)->ItemID == itemId)) {
|
|
||||||
return getSInventory()->GetData(i)->Count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;*/
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Entity::cget_craft_material_count(int itemId) {
|
|
||||||
/*
|
|
||||||
for (int i = 0; i < getCCraftMaterialInventory()->Count; i += 1) {
|
|
||||||
if (getCCraftMaterialInventory()->GetData(i)->ItemID == itemId) {
|
|
||||||
return getCCraftMaterialInventory()->GetData(i)->Count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;*/
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Entity::sget_craft_material_count(int itemId) {
|
|
||||||
/*
|
|
||||||
for (int i = 0; i < getSCraftMaterialInventory()->Count; i += 1) {
|
|
||||||
if (getSCraftMaterialInventory()->GetData(i)->ItemID == itemId) {
|
|
||||||
return getSCraftMaterialInventory()->GetData(i)->Count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;*/
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Entity::ccan_craft(CraftDataAttribute *cda) {
|
bool Entity::ccan_craft(CraftDataAttribute *cda) {
|
||||||
/*
|
|
||||||
for (int i = 0; i < cda->RequiredItems->Count; i += 1) {
|
|
||||||
if (!CHasItem(cda->RequiredItems->GetData(i), 1)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int j = 0; j < cda->RequiredMaterials->Count; j += 1) {
|
|
||||||
CraftDataAttributeHelper *craftDataAttributeHelper = cda->RequiredMaterials->GetData(j);
|
|
||||||
if (!CHasCraftMaterial(craftDataAttributeHelper->ItemId, craftDataAttributeHelper->Count)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;*/
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Entity::ctry_to_craft(CraftDataAttribute *cda) {
|
bool Entity::ctry_to_craft(CraftDataAttribute *cda) {
|
||||||
/*
|
|
||||||
if (!CCanCraft(cda)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
CSendCraftItemRequest(cda->Id);
|
|
||||||
return true;*/
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Entity::scan_craft(CraftDataAttribute *cda) {
|
bool Entity::scan_craft(CraftDataAttribute *cda) {
|
||||||
/*
|
|
||||||
for (int i = 0; i < cda->RequiredItems->Count; i += 1) {
|
|
||||||
if (!SHasItem(cda->RequiredItems->GetData(i), 1)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int j = 0; j < cda->RequiredMaterials->Count; j += 1) {
|
|
||||||
CraftDataAttributeHelper *craftDataAttributeHelper = cda->RequiredMaterials->GetData(j);
|
|
||||||
if (!SHasCraftMaterial(craftDataAttributeHelper->ItemId, craftDataAttributeHelper->Count)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;*/
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::scraft(CraftDataAttribute *cda) {
|
void Entity::scraft(CraftDataAttribute *cda) {
|
||||||
/*
|
|
||||||
if (!STryToAddItem(cda->Item->ItemId, cda->Item->Count)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < cda->RequiredMaterials->Count; i += 1) {
|
|
||||||
CraftDataAttributeHelper *craftDataAttributeHelper = cda->RequiredMaterials->GetData(i);
|
|
||||||
SRemoveCraftMaterial(craftDataAttributeHelper->ItemId, craftDataAttributeHelper->Count);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::sreceive_craft_item_msg(int craftId) {
|
void Entity::sreceive_craft_item_msg(int craftId) {
|
||||||
/*
|
|
||||||
CraftDataLoader *instance = CraftDataLoader::Instance;
|
|
||||||
if (instance == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
CraftDataAttribute *craftDataWithId = instance->getCraftDataWithId(craftId);
|
|
||||||
if (craftDataWithId == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!SCanCraft(craftDataWithId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
SCraft(craftDataWithId);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::cswap_items_in_slots(int slot1, int slot2) {
|
void Entity::cswap_items_in_slots(int slot1, int slot2) {
|
||||||
/*
|
|
||||||
if ((slot1 >= getCInventory()->Count) || (slot2 >= getCInventory()->Count)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((getCInventory()->GetData(slot1) == null) && (getCInventory()->GetData(slot2) == null)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
CSendSwapItems(slot1, slot2); */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::loaded() {
|
void Entity::loaded() {
|
||||||
@ -2249,54 +1711,27 @@ void Entity::rpc_level_up() {
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::registers() {
|
|
||||||
/*
|
|
||||||
if (aiPlayer) {
|
|
||||||
Entity.CRegisterAIPlayer(GUID, owner);
|
|
||||||
|
|
||||||
if (owner.isServer) {
|
|
||||||
Entity.SRegisterAIPlayer(GUID, owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
// owner.OnPlayerSpawned(owner, owner.isClient, owner.isServer, owner.isLocalPlayer);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isLocalPlayer) {
|
|
||||||
Entity.RegisterLocalPlayer(GUID, owner);
|
|
||||||
|
|
||||||
//Let's call the playerFactory, so it can modify this instance
|
|
||||||
// owner.OnPlayerSpawned(owner, owner.isClient, owner.isServer, owner.isLocalPlayer);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (owner.isClient) {
|
|
||||||
Entity.CRegisterNetworkedPlayer(GUID, owner);
|
|
||||||
|
|
||||||
if (owner.isServer) {
|
|
||||||
Entity.SRegisterNetworkedPlayer(GUID, owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Let's call the playerFactory, so it can modify this instance
|
|
||||||
// owner.OnPlayerSpawned(owner, owner.isClient, owner.isServer, owner.isLocalPlayer);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
pl.CRegisterAIPlayer(transform.gameObject);
|
|
||||||
|
|
||||||
if (isServer)
|
|
||||||
{
|
|
||||||
pl.SRegisterAIPlayer(transform.gameObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Let's call the playerFactory, so it can modify this instance
|
|
||||||
pf.OnPlayerSpawned(gameObject, isClient, isServer, isLocalPlayer);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void Entity::update(float delta) {
|
void Entity::update(float delta) {
|
||||||
|
if (_s_gcd > 0.0000001) {
|
||||||
|
_s_gcd -= delta;
|
||||||
|
|
||||||
|
if (_s_gcd <= 0) {
|
||||||
|
_s_gcd = 0;
|
||||||
|
|
||||||
|
emit_signal("sgcd_finished");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_c_gcd > 0.0000001) {
|
||||||
|
_c_gcd -= delta;
|
||||||
|
|
||||||
|
if (_c_gcd <= 0) {
|
||||||
|
_c_gcd = 0;
|
||||||
|
|
||||||
|
emit_signal("cgcd_finished");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < _s_cooldowns.size(); ++i) {
|
for (int i = 0; i < _s_cooldowns.size(); ++i) {
|
||||||
Ref<Cooldown> cd = _s_cooldowns.get(i);
|
Ref<Cooldown> cd = _s_cooldowns.get(i);
|
||||||
|
|
||||||
@ -2324,58 +1759,6 @@ void Entity::update(float delta) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::Update() {
|
|
||||||
/*
|
|
||||||
getInventory()->Update();
|
|
||||||
getPlayerFacingComponent()->Update();
|
|
||||||
getStateComponent()->Update();
|
|
||||||
getPlayerSpellDataComponent()->Update();
|
|
||||||
getOpmcc()->Update();
|
|
||||||
getEntity()->Update();
|
|
||||||
getFactionComponent()->Update();*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (owner->isServer && sendstate) {
|
|
||||||
sendstate = false;
|
|
||||||
SendAllItems();
|
|
||||||
} */
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (send && owner->isServer) {
|
|
||||||
send = false;
|
|
||||||
for (int i = 0; i < getSSpellData()->Count; i += 1) {
|
|
||||||
PlayerSpellData *playerSpellData = getSSpellData()->GetData(i);
|
|
||||||
if (is_inst_of<PlayerSpellCooldownData *>(playerSpellData)) {
|
|
||||||
PlayerSpellCooldownData *playerSpellCooldownData = as_cast<PlayerSpellCooldownData *>(playerSpellData);
|
|
||||||
SSendAddCPlayerSpellCooldownData(playerSpellCooldownData->SpellId, playerSpellCooldownData->getCooldown(), playerSpellCooldownData->getRemainingCooldown());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int j = 0; j < sSpellData->Count; j += 1) {
|
|
||||||
sSpellData->GetData(j)->Update(this);
|
|
||||||
}
|
|
||||||
for (int k = 0; k < cSpellData->Count; k += 1) {
|
|
||||||
cSpellData->GetData(k)->Update(this);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (owner->PlayerData->State != PlayerStates::STATE_NORMAL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (getSCasting()) {
|
|
||||||
setSCurrentCastTime(Time::deltaTime);
|
|
||||||
if (getSCurrentCastTime() >= getSCastTime()) {
|
|
||||||
SCastFinished();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (getCCasting()) {
|
|
||||||
setCCurrentCastTime(Time::deltaTime);
|
|
||||||
if (getCCurrentCastTime() >= getCCastTime()) {
|
|
||||||
CCastFinished();
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
String Entity::request_spell_name(int spellId) {
|
String Entity::request_spell_name(int spellId) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -2593,7 +1976,9 @@ void Entity::_bind_methods() {
|
|||||||
|
|
||||||
//GCD
|
//GCD
|
||||||
ADD_SIGNAL(MethodInfo("sgcd_started", PropertyInfo(Variant::REAL, "value")));
|
ADD_SIGNAL(MethodInfo("sgcd_started", PropertyInfo(Variant::REAL, "value")));
|
||||||
|
ADD_SIGNAL(MethodInfo("sgcd_finished", PropertyInfo(Variant::REAL, "value")));
|
||||||
ADD_SIGNAL(MethodInfo("cgcd_started", PropertyInfo(Variant::REAL, "value")));
|
ADD_SIGNAL(MethodInfo("cgcd_started", PropertyInfo(Variant::REAL, "value")));
|
||||||
|
ADD_SIGNAL(MethodInfo("cgcd_finished", PropertyInfo(Variant::REAL, "value")));
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("getc_has_global_cooldown"), &Entity::getc_has_global_cooldown);
|
ClassDB::bind_method(D_METHOD("getc_has_global_cooldown"), &Entity::getc_has_global_cooldown);
|
||||||
ClassDB::bind_method(D_METHOD("gets_has_global_cooldown"), &Entity::gets_has_global_cooldown);
|
ClassDB::bind_method(D_METHOD("gets_has_global_cooldown"), &Entity::gets_has_global_cooldown);
|
||||||
|
@ -422,13 +422,9 @@ public:
|
|||||||
|
|
||||||
//// Inventory ////
|
//// Inventory ////
|
||||||
|
|
||||||
|
|
||||||
Ref<Bag> gets_bag(int index);
|
Ref<Bag> gets_bag(int index);
|
||||||
Ref<Bag> getc_bag(int index);
|
Ref<Bag> getc_bag(int index);
|
||||||
|
|
||||||
//void Update();
|
|
||||||
void sadd_craft_material(int itemId, int count);
|
|
||||||
void sremove_craft_material(int itemId, int count);
|
|
||||||
bool stry_to_add_item(int itemId, int count);
|
bool stry_to_add_item(int itemId, int count);
|
||||||
bool stry_to_remove_item(int itemId, int count);
|
bool stry_to_remove_item(int itemId, int count);
|
||||||
void ssend_add_item(int slotId, int itemId, int count);
|
void ssend_add_item(int slotId, int itemId, int count);
|
||||||
@ -438,26 +434,16 @@ public:
|
|||||||
void ssend_sent_items(String items);
|
void ssend_sent_items(String items);
|
||||||
void csend_swap_items(int slot1, int slot2);
|
void csend_swap_items(int slot1, int slot2);
|
||||||
void csend_craft_item_request(int craftId);
|
void csend_craft_item_request(int craftId);
|
||||||
void ssend_add_craft_material(int itemId, int count);
|
|
||||||
void ssend_remove_craft_material(int itemId, int count);
|
|
||||||
void ssend_sent_craft_materials(String materials);
|
|
||||||
void creceive_add_item(int slotId, int itemId, int count);
|
void creceive_add_item(int slotId, int itemId, int count);
|
||||||
void creceive_change_item_count(int slotId, int count);
|
void creceive_change_item_count(int slotId, int count);
|
||||||
void creceive_remove_item(int slotId);
|
void creceive_remove_item(int slotId);
|
||||||
void creceive_move_item(int slot1, int slot2);
|
void creceive_move_item(int slot1, int slot2);
|
||||||
void creceive_add_craft_material(int itemId, int count);
|
|
||||||
void creceive_remove_craft_material(int itemId, int count);
|
|
||||||
void creceive_sent_craft_materials(String materials);
|
|
||||||
void creceive_sent_items(String items);
|
void creceive_sent_items(String items);
|
||||||
void sreceive_swap_items(int slot1, int slot2);
|
void sreceive_swap_items(int slot1, int slot2);
|
||||||
bool shas_craft_material(int itemId, int count);
|
|
||||||
bool shas_item(int itemId, int count);
|
bool shas_item(int itemId, int count);
|
||||||
bool chas_craft_material(int itemId, int count);
|
|
||||||
bool chas_item(int itemId, int count);
|
bool chas_item(int itemId, int count);
|
||||||
int cget_item_count(int itemId);
|
int cget_item_count(int itemId);
|
||||||
int sget_item_count(int itemId);
|
int sget_item_count(int itemId);
|
||||||
int cget_craft_material_count(int itemId);
|
|
||||||
int sget_craft_material_count(int itemId);
|
|
||||||
bool ccan_craft(CraftDataAttribute *cda);
|
bool ccan_craft(CraftDataAttribute *cda);
|
||||||
bool ctry_to_craft(CraftDataAttribute *cda);
|
bool ctry_to_craft(CraftDataAttribute *cda);
|
||||||
bool scan_craft(CraftDataAttribute *cda);
|
bool scan_craft(CraftDataAttribute *cda);
|
||||||
@ -545,7 +531,6 @@ private:
|
|||||||
bool c;
|
bool c;
|
||||||
float sRezTimer;
|
float sRezTimer;
|
||||||
float cRezTimer;
|
float cRezTimer;
|
||||||
//bool init;
|
|
||||||
|
|
||||||
//// GCD ////
|
//// GCD ////
|
||||||
float _s_gcd;
|
float _s_gcd;
|
||||||
|
@ -15,7 +15,6 @@ Stat::Stat() {
|
|||||||
_c_max = (float)(0);
|
_c_max = (float)(0);
|
||||||
_c_current = (float)(0);
|
_c_current = (float)(0);
|
||||||
|
|
||||||
_modifiers = memnew(Vector<Ref<StatModifier> >());
|
|
||||||
_disabled = false;
|
_disabled = false;
|
||||||
_modifier_apply_type = MODIFIER_APPLY_TYPE_STANDARD;
|
_modifier_apply_type = MODIFIER_APPLY_TYPE_STANDARD;
|
||||||
}
|
}
|
||||||
@ -31,7 +30,6 @@ Stat::Stat(Stat::StatId id) {
|
|||||||
_c_max = (float)(0);
|
_c_max = (float)(0);
|
||||||
_c_current = (float)(0);
|
_c_current = (float)(0);
|
||||||
|
|
||||||
_modifiers = memnew(Vector<Ref<StatModifier> >());
|
|
||||||
_disabled = false;
|
_disabled = false;
|
||||||
_modifier_apply_type = MODIFIER_APPLY_TYPE_STANDARD;
|
_modifier_apply_type = MODIFIER_APPLY_TYPE_STANDARD;
|
||||||
}
|
}
|
||||||
@ -47,7 +45,6 @@ Stat::Stat(Stat::StatId id, StatModifierApplyType modifier_apply_type) {
|
|||||||
_c_max = (float)(0);
|
_c_max = (float)(0);
|
||||||
_c_current = (float)(0);
|
_c_current = (float)(0);
|
||||||
|
|
||||||
_modifiers = memnew(Vector<Ref<StatModifier> >());
|
|
||||||
_disabled = false;
|
_disabled = false;
|
||||||
_modifier_apply_type = modifier_apply_type;
|
_modifier_apply_type = modifier_apply_type;
|
||||||
_id = id;
|
_id = id;
|
||||||
@ -64,7 +61,6 @@ Stat::Stat(Stat::StatId id, StatModifierApplyType modifier_apply_type, float bas
|
|||||||
_s_current = (float)(0);
|
_s_current = (float)(0);
|
||||||
_c_max = (float)(0);
|
_c_max = (float)(0);
|
||||||
_c_current = (float)(0);
|
_c_current = (float)(0);
|
||||||
_modifiers = memnew(Vector<Ref<StatModifier> >());
|
|
||||||
_disabled = false;
|
_disabled = false;
|
||||||
_modifier_apply_type = modifier_apply_type;
|
_modifier_apply_type = modifier_apply_type;
|
||||||
|
|
||||||
@ -88,7 +84,6 @@ Stat::Stat(Stat::StatId id, StatModifierApplyType modifier_apply_type, float bas
|
|||||||
_c_max = (float)(0);
|
_c_max = (float)(0);
|
||||||
_c_current = (float)(0);
|
_c_current = (float)(0);
|
||||||
|
|
||||||
_modifiers = memnew(Vector<Ref<StatModifier> >());
|
|
||||||
_disabled = false;
|
_disabled = false;
|
||||||
_modifier_apply_type = modifier_apply_type;
|
_modifier_apply_type = modifier_apply_type;
|
||||||
_id = id;
|
_id = id;
|
||||||
@ -100,21 +95,19 @@ Stat::Stat(Stat::StatId id, StatModifierApplyType modifier_apply_type, float bas
|
|||||||
}
|
}
|
||||||
|
|
||||||
Stat::~Stat() {
|
Stat::~Stat() {
|
||||||
_modifiers->clear();
|
_modifiers.clear();
|
||||||
|
|
||||||
memdelete(_modifiers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_FORCE_INLINE_ Vector<Ref<StatModifier> > *Stat::get_modifiers() {
|
_FORCE_INLINE_ Vector<Ref<StatModifier> > *Stat::get_modifiers() {
|
||||||
return _modifiers;
|
return &_modifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Stat::get_modifier_count() {
|
int Stat::get_modifier_count() {
|
||||||
return _modifiers->size();
|
return _modifiers.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<StatModifier> Stat::get_modifier(int index) {
|
Ref<StatModifier> Stat::get_modifier(int index) {
|
||||||
return _modifiers->get(index);
|
return _modifiers.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stat::set_dependency(Ref<Stat> other, Ref<Curve> curve) {
|
void Stat::set_dependency(Ref<Stat> other, Ref<Curve> curve) {
|
||||||
@ -168,14 +161,14 @@ void Stat::add_modifier(int id, float _max_mod, float percent_mod, bool apply) {
|
|||||||
apply_modifier(statModifier);
|
apply_modifier(statModifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
_modifiers->push_back(statModifier);
|
_modifiers.push_back(statModifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stat::remove_modifier(int id, bool apply) {
|
void Stat::remove_modifier(int id, bool apply) {
|
||||||
for (int i = 0; i < _modifiers->size(); i += 1) {
|
for (int i = 0; i < _modifiers.size(); i += 1) {
|
||||||
if (_modifiers->get(i)->get_id() == id) {
|
if (_modifiers.get(i)->get_id() == id) {
|
||||||
Ref<StatModifier> modifier = _modifiers->get(i);
|
Ref<StatModifier> modifier = _modifiers.get(i);
|
||||||
_modifiers->remove(i);
|
_modifiers.remove(i);
|
||||||
|
|
||||||
if (apply) {
|
if (apply) {
|
||||||
de_apply_modifier(modifier);
|
de_apply_modifier(modifier);
|
||||||
@ -199,16 +192,16 @@ void Stat::apply_modifier(Ref<StatModifier> modifier) {
|
|||||||
if (get_modifiers()->size() > 0) {
|
if (get_modifiers()->size() > 0) {
|
||||||
float percent_mod = get_modifiers()->get(0)->get_percent_mod();
|
float percent_mod = get_modifiers()->get(0)->get_percent_mod();
|
||||||
for (int i = 1; i < get_modifiers()->size(); i += 1) {
|
for (int i = 1; i < get_modifiers()->size(); i += 1) {
|
||||||
if ((_modifiers->get(i)->get_percent_mod() < (float)0) && (_modifiers->get(i)->get_percent_mod() < percent_mod)) {
|
if ((_modifiers.get(i)->get_percent_mod() < (float)0) && (_modifiers.get(i)->get_percent_mod() < percent_mod)) {
|
||||||
num = i;
|
num = i;
|
||||||
percent_mod = _modifiers->get(i)->get_percent_mod();
|
percent_mod = _modifiers.get(i)->get_percent_mod();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num != -1) {
|
if (num != -1) {
|
||||||
if (modifier->get_percent_mod() < _modifiers->get(num)->get_percent_mod()) {
|
if (modifier->get_percent_mod() < _modifiers.get(num)->get_percent_mod()) {
|
||||||
_percent -= _modifiers->get(num)->get_percent_mod();
|
_percent -= _modifiers.get(num)->get_percent_mod();
|
||||||
}
|
}
|
||||||
|
|
||||||
_percent += modifier->get_percent_mod();
|
_percent += modifier->get_percent_mod();
|
||||||
@ -236,20 +229,20 @@ void Stat::de_apply_modifier(Ref<StatModifier> modifier) {
|
|||||||
float percent_mod = get_modifiers()->get(0)->get_percent_mod();
|
float percent_mod = get_modifiers()->get(0)->get_percent_mod();
|
||||||
|
|
||||||
for (int i = 1; i < get_modifiers()->size(); i += 1) {
|
for (int i = 1; i < get_modifiers()->size(); i += 1) {
|
||||||
if ((_modifiers->get(i)->get_percent_mod() < (float)0) && (_modifiers->get(i)->get_percent_mod() < percent_mod)) {
|
if ((_modifiers.get(i)->get_percent_mod() < (float)0) && (_modifiers.get(i)->get_percent_mod() < percent_mod)) {
|
||||||
num = i;
|
num = i;
|
||||||
percent_mod = _modifiers->get(i)->get_percent_mod();
|
percent_mod = _modifiers.get(i)->get_percent_mod();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num != -1 && (*_modifiers)[num] == modifier) {
|
if (num != -1 && _modifiers[num] == modifier) {
|
||||||
_percent -= modifier->get_percent_mod();
|
_percent -= modifier->get_percent_mod();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_modifiers->size() == 0) {
|
if (_modifiers.size() == 0) {
|
||||||
recalculate();
|
recalculate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,8 +253,8 @@ void Stat::re_apply_modifiers() {
|
|||||||
reset_values();
|
reset_values();
|
||||||
|
|
||||||
if (_modifier_apply_type == MODIFIER_APPLY_TYPE_STANDARD) {
|
if (_modifier_apply_type == MODIFIER_APPLY_TYPE_STANDARD) {
|
||||||
for (int i = 0; i < _modifiers->size(); i += 1) {
|
for (int i = 0; i < _modifiers.size(); i += 1) {
|
||||||
Ref<StatModifier> mod = _modifiers->get(i);
|
Ref<StatModifier> mod = _modifiers.get(i);
|
||||||
|
|
||||||
_bonus += mod->get_bonus_mod();
|
_bonus += mod->get_bonus_mod();
|
||||||
_percent += mod->get_percent_mod();
|
_percent += mod->get_percent_mod();
|
||||||
@ -270,7 +263,7 @@ void Stat::re_apply_modifiers() {
|
|||||||
re_apply_modifier_not_negative_stacking_percents();
|
re_apply_modifier_not_negative_stacking_percents();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_modifiers->size() == 0) {
|
if (_modifiers.size() == 0) {
|
||||||
recalculate();
|
recalculate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,8 +274,8 @@ void Stat::re_apply_modifier_not_negative_stacking_percents() {
|
|||||||
reset_values();
|
reset_values();
|
||||||
|
|
||||||
for (int i = 1; i < get_modifiers()->size(); i += 1) {
|
for (int i = 1; i < get_modifiers()->size(); i += 1) {
|
||||||
if (_modifiers->get(i)->get_percent_mod() > (float)0) {
|
if (_modifiers.get(i)->get_percent_mod() > (float)0) {
|
||||||
Ref<StatModifier> mod = _modifiers->get(i);
|
Ref<StatModifier> mod = _modifiers.get(i);
|
||||||
|
|
||||||
_bonus += mod->get_bonus_mod();
|
_bonus += mod->get_bonus_mod();
|
||||||
_percent += mod->get_percent_mod();
|
_percent += mod->get_percent_mod();
|
||||||
@ -295,15 +288,15 @@ void Stat::re_apply_modifier_not_negative_stacking_percents() {
|
|||||||
|
|
||||||
for (int j = 1; j < get_modifiers()->size(); ++j) {
|
for (int j = 1; j < get_modifiers()->size(); ++j) {
|
||||||
|
|
||||||
if ((_modifiers->get(j)->get_percent_mod() < (float)0) && (_modifiers->get(j)->get_percent_mod() < percent_mod)) {
|
if ((_modifiers.get(j)->get_percent_mod() < (float)0) && (_modifiers.get(j)->get_percent_mod() < percent_mod)) {
|
||||||
num = j;
|
num = j;
|
||||||
percent_mod = _modifiers->get(j)->get_percent_mod();
|
percent_mod = _modifiers.get(j)->get_percent_mod();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num != -1) {
|
if (num != -1) {
|
||||||
Ref<StatModifier> mod = _modifiers->get(num);
|
Ref<StatModifier> mod = _modifiers.get(num);
|
||||||
|
|
||||||
_bonus += mod->get_bonus_mod();
|
_bonus += mod->get_bonus_mod();
|
||||||
_percent += mod->get_percent_mod();
|
_percent += mod->get_percent_mod();
|
||||||
|
@ -178,7 +178,7 @@ private:
|
|||||||
|
|
||||||
StatModifierApplyType _modifier_apply_type;
|
StatModifierApplyType _modifier_apply_type;
|
||||||
|
|
||||||
Vector<Ref<StatModifier> > *_modifiers;
|
Vector<Ref<StatModifier> > _modifiers;
|
||||||
|
|
||||||
bool _dirty;
|
bool _dirty;
|
||||||
bool _disabled;
|
bool _disabled;
|
||||||
|
@ -3,4 +3,5 @@
|
|||||||
const String EntityEnums::BINDING_STRING_PLAYER_RESOURCE_TYPES = "None, Rage, Mana, Energy, Time Anomaly";
|
const String EntityEnums::BINDING_STRING_PLAYER_RESOURCE_TYPES = "None, Rage, Mana, Energy, Time Anomaly";
|
||||||
const String EntityEnums::BINDING_STRING_ENTITY_TYPES = "None, Player, AI, Mob";
|
const String EntityEnums::BINDING_STRING_ENTITY_TYPES = "None, Player, AI, Mob";
|
||||||
const String EntityEnums::BINDING_STRING_ENTITY_STATE_TYPES = "None, Stun, Root, Frozen, Silenced, Disoriented, Feared, Burning, Cold, Cursed, Pacified";
|
const String EntityEnums::BINDING_STRING_ENTITY_STATE_TYPES = "None, Stun, Root, Frozen, Silenced, Disoriented, Feared, Burning, Cold, Cursed, Pacified";
|
||||||
const String EntityEnums::BINDING_STRING_CHARCATER_SKELETON_BONE_ID = "Hip, Left Hand, Right Hand";
|
const String EntityEnums::BINDING_STRING_CHARCATER_SKELETON_POINTS = "Hip, Left Hand, Right Hand, Weapon, Base, Body, Head, Right Eye, Left Eye";
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ public:
|
|||||||
static const String BINDING_STRING_PLAYER_RESOURCE_TYPES;
|
static const String BINDING_STRING_PLAYER_RESOURCE_TYPES;
|
||||||
static const String BINDING_STRING_ENTITY_TYPES;
|
static const String BINDING_STRING_ENTITY_TYPES;
|
||||||
static const String BINDING_STRING_ENTITY_STATE_TYPES;
|
static const String BINDING_STRING_ENTITY_STATE_TYPES;
|
||||||
static const String BINDING_STRING_CHARCATER_SKELETON_BONE_ID;
|
static const String BINDING_STRING_CHARCATER_SKELETON_POINTS;
|
||||||
|
|
||||||
enum PlayerResourceTypes {
|
enum PlayerResourceTypes {
|
||||||
PLAYER_RESOURCE_TYPES_NONE,
|
PLAYER_RESOURCE_TYPES_NONE,
|
||||||
@ -85,11 +85,18 @@ public:
|
|||||||
return ENTITY_STATE_TYPE_FLAG_NONE;
|
return ENTITY_STATE_TYPE_FLAG_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum CharacterSkeletonBoneId {
|
enum CharacterSkeletonPoints {
|
||||||
BONE_ID_HIP = 0,
|
SKELETON_POINT_HIP = 0,
|
||||||
BONE_ID_LEFT_HAND = 1,
|
SKELETON_POINT_LEFT_HAND = 1,
|
||||||
BONE_ID_RIGHT_HAND = 2,
|
SKELETON_POINT_RIGHT_HAND = 2,
|
||||||
MAX_BONE_ID = 3,
|
SKELETON_POINT_WEAPON = 3,
|
||||||
|
SKELETON_POINT_BASE = 4,
|
||||||
|
SKELETON_POINT_BODY = 5,
|
||||||
|
SKELETON_POINT_HEAD = 6,
|
||||||
|
SKELETON_POINT_RIGHT_EYE = 7,
|
||||||
|
SKELETON_POINT_LEFT_EYE = 8,
|
||||||
|
|
||||||
|
SKELETON_POINTS_MAX = 9,
|
||||||
};
|
};
|
||||||
|
|
||||||
EntityEnums() {}
|
EntityEnums() {}
|
||||||
@ -132,10 +139,16 @@ protected:
|
|||||||
BIND_ENUM_CONSTANT(ENTITY_STATE_TYPE_INDEX_PACIFIED);
|
BIND_ENUM_CONSTANT(ENTITY_STATE_TYPE_INDEX_PACIFIED);
|
||||||
BIND_ENUM_CONSTANT(ENTITY_STATE_TYPE_INDEX_MAX);
|
BIND_ENUM_CONSTANT(ENTITY_STATE_TYPE_INDEX_MAX);
|
||||||
|
|
||||||
BIND_ENUM_CONSTANT(BONE_ID_HIP);
|
BIND_ENUM_CONSTANT(SKELETON_POINT_HIP);
|
||||||
BIND_ENUM_CONSTANT(BONE_ID_LEFT_HAND);
|
BIND_ENUM_CONSTANT(SKELETON_POINT_LEFT_HAND);
|
||||||
BIND_ENUM_CONSTANT(BONE_ID_RIGHT_HAND);
|
BIND_ENUM_CONSTANT(SKELETON_POINT_RIGHT_HAND);
|
||||||
BIND_ENUM_CONSTANT(MAX_BONE_ID);
|
BIND_ENUM_CONSTANT(SKELETON_POINT_WEAPON);
|
||||||
|
BIND_ENUM_CONSTANT(SKELETON_POINT_BASE);
|
||||||
|
BIND_ENUM_CONSTANT(SKELETON_POINT_BODY);
|
||||||
|
BIND_ENUM_CONSTANT(SKELETON_POINT_HEAD);
|
||||||
|
BIND_ENUM_CONSTANT(SKELETON_POINT_RIGHT_EYE);
|
||||||
|
BIND_ENUM_CONSTANT(SKELETON_POINT_LEFT_EYE);
|
||||||
|
BIND_ENUM_CONSTANT(SKELETON_POINTS_MAX);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -143,6 +156,6 @@ VARIANT_ENUM_CAST(EntityEnums::EntityType);
|
|||||||
VARIANT_ENUM_CAST(EntityEnums::PlayerResourceTypes);
|
VARIANT_ENUM_CAST(EntityEnums::PlayerResourceTypes);
|
||||||
VARIANT_ENUM_CAST(EntityEnums::EntityStateTypeFlags);
|
VARIANT_ENUM_CAST(EntityEnums::EntityStateTypeFlags);
|
||||||
VARIANT_ENUM_CAST(EntityEnums::EntityStateTypeIndexes);
|
VARIANT_ENUM_CAST(EntityEnums::EntityStateTypeIndexes);
|
||||||
VARIANT_ENUM_CAST(EntityEnums::CharacterSkeletonBoneId);
|
VARIANT_ENUM_CAST(EntityEnums::CharacterSkeletonPoints);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,38 +1,38 @@
|
|||||||
#include "bag.h"
|
#include "bag.h"
|
||||||
|
|
||||||
Ref<BagSlot> Bag::get_slot(int index) {
|
Ref<BagSlot> Bag::get_slot(int index) {
|
||||||
ERR_FAIL_INDEX_V(index, _slots->size(), Ref<BagSlot>(NULL));
|
ERR_FAIL_INDEX_V(index, _slots.size(), Ref<BagSlot>(NULL));
|
||||||
|
|
||||||
return (_slots->get(index));
|
return (_slots.get(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<BagSlot> Bag::get_and_remove_slot(int index) {
|
Ref<BagSlot> Bag::get_and_remove_slot(int index) {
|
||||||
ERR_FAIL_INDEX_V(index, _slots->size(), Ref<BagSlot>(NULL));
|
ERR_FAIL_INDEX_V(index, _slots.size(), Ref<BagSlot>(NULL));
|
||||||
|
|
||||||
Ref<BagSlot> slot = _slots->get(index);
|
Ref<BagSlot> slot = _slots.get(index);
|
||||||
|
|
||||||
_slots->set(index, Ref<BagSlot>(memnew(BagSlot())));
|
_slots.set(index, Ref<BagSlot>(memnew(BagSlot())));
|
||||||
|
|
||||||
return slot;
|
return slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Bag::get_slot_count() {
|
int Bag::get_slot_count() {
|
||||||
return _slots->size();
|
return _slots.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bag::set_slot_count(int count) {
|
void Bag::set_slot_count(int count) {
|
||||||
ERR_FAIL_COND(_slots->size() != 0);
|
ERR_FAIL_COND(_slots.size() > count);
|
||||||
|
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
_slots->push_back(memnew(BagSlot()));
|
_slots.push_back(Ref<BagSlot>(memnew(BagSlot())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Bag::try_to_add_item(Ref<ItemInstance> item, int count) {
|
bool Bag::try_to_add_item(Ref<ItemInstance> item, int count) {
|
||||||
ERR_FAIL_COND_V(!item.is_valid(), false);
|
ERR_FAIL_COND_V(!item.is_valid(), false);
|
||||||
|
|
||||||
for (int i = 0; i < _slots->size(); ++i) {
|
for (int i = 0; i < _slots.size(); ++i) {
|
||||||
Ref<BagSlot> slot = _slots->get(i);
|
Ref<BagSlot> slot = _slots.get(i);
|
||||||
|
|
||||||
if (!slot->has_item()) {
|
if (!slot->has_item()) {
|
||||||
slot->set_item(item);
|
slot->set_item(item);
|
||||||
@ -48,9 +48,9 @@ bool Bag::try_to_add_item(Ref<ItemInstance> item, int count) {
|
|||||||
bool Bag::add_item_to_slot(Ref<ItemInstance> item, int slot_index, int count) {
|
bool Bag::add_item_to_slot(Ref<ItemInstance> item, int slot_index, int count) {
|
||||||
ERR_FAIL_COND_V(!item.is_valid(), false);
|
ERR_FAIL_COND_V(!item.is_valid(), false);
|
||||||
|
|
||||||
ERR_FAIL_INDEX_V(slot_index, _slots->size(), false);
|
ERR_FAIL_INDEX_V(slot_index, _slots.size(), false);
|
||||||
|
|
||||||
Ref<BagSlot> slot = _slots->get(slot_index);
|
Ref<BagSlot> slot = _slots.get(slot_index);
|
||||||
|
|
||||||
ERR_FAIL_COND_V(!slot.is_valid(), false);
|
ERR_FAIL_COND_V(!slot.is_valid(), false);
|
||||||
|
|
||||||
@ -64,13 +64,10 @@ bool Bag::add_item_to_slot(Ref<ItemInstance> item, int slot_index, int count) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bag::Bag() {
|
Bag::Bag() {
|
||||||
_slots = memnew(Vector<Ref<BagSlot> >());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Bag::~Bag() {
|
Bag::~Bag() {
|
||||||
_slots->clear();
|
_slots.clear();
|
||||||
|
|
||||||
memdelete(_slots);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bag::_bind_methods() {
|
void Bag::_bind_methods() {
|
||||||
|
@ -26,7 +26,7 @@ protected:
|
|||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<Ref<BagSlot> > *_slots;
|
Vector<Ref<BagSlot> > _slots;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#include "data/item_instance.h"
|
#include "data/item_instance.h"
|
||||||
|
|
||||||
#include "data/spell.h"
|
#include "data/spell.h"
|
||||||
#include "data/icon.h"
|
|
||||||
#include "entities/stats/stat.h"
|
#include "entities/stats/stat.h"
|
||||||
#include "entities/stats/stat_data.h"
|
#include "entities/stats/stat_data.h"
|
||||||
#include "entities/player_talent.h"
|
#include "entities/player_talent.h"
|
||||||
@ -41,7 +40,6 @@
|
|||||||
#include "entities/entity.h"
|
#include "entities/entity.h"
|
||||||
#include "entities/player.h"
|
#include "entities/player.h"
|
||||||
#include "entities/mob.h"
|
#include "entities/mob.h"
|
||||||
#include "spells/spell_manager.h"
|
|
||||||
#include "data/aura_trigger_data.h"
|
#include "data/aura_trigger_data.h"
|
||||||
#include "data/aura_stat_attribute.h"
|
#include "data/aura_stat_attribute.h"
|
||||||
|
|
||||||
@ -60,7 +58,6 @@ void register_entity_spell_system_types() {
|
|||||||
ClassDB::register_class<SpellEnums>();
|
ClassDB::register_class<SpellEnums>();
|
||||||
|
|
||||||
//data
|
//data
|
||||||
ClassDB::register_class<Icon>();
|
|
||||||
ClassDB::register_class<CraftDataAttributeHelper>();
|
ClassDB::register_class<CraftDataAttributeHelper>();
|
||||||
ClassDB::register_class<CraftDataAttribute>();
|
ClassDB::register_class<CraftDataAttribute>();
|
||||||
|
|
||||||
@ -108,9 +105,6 @@ void register_entity_spell_system_types() {
|
|||||||
ClassDB::register_class<Player>();
|
ClassDB::register_class<Player>();
|
||||||
ClassDB::register_class<Mob>();
|
ClassDB::register_class<Mob>();
|
||||||
|
|
||||||
//deprecated
|
|
||||||
ClassDB::register_class<SpellManager>();
|
|
||||||
|
|
||||||
//spellinfos
|
//spellinfos
|
||||||
ClassDB::register_class<SpellCastInfo>();
|
ClassDB::register_class<SpellCastInfo>();
|
||||||
|
|
||||||
|
@ -2,20 +2,20 @@
|
|||||||
|
|
||||||
|
|
||||||
NodePath CharacterSkeleton::get_bone_path(int index) {
|
NodePath CharacterSkeleton::get_bone_path(int index) {
|
||||||
ERR_FAIL_INDEX_V(index, EntityEnums::MAX_BONE_ID, NodePath());
|
ERR_FAIL_INDEX_V(index, EntityEnums::SKELETON_POINTS_MAX, NodePath());
|
||||||
|
|
||||||
return _bone_paths[index];
|
return _bone_paths[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterSkeleton::set_bone_path(int index, NodePath path) {
|
void CharacterSkeleton::set_bone_path(int index, NodePath path) {
|
||||||
ERR_FAIL_INDEX(index, EntityEnums::MAX_BONE_ID);
|
ERR_FAIL_INDEX(index, EntityEnums::SKELETON_POINTS_MAX);
|
||||||
|
|
||||||
_bone_paths[index] = path;
|
_bone_paths[index] = path;
|
||||||
|
|
||||||
_bone_nodes[index] = get_node_or_null(path);
|
_bone_nodes[index] = get_node_or_null(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
Node *CharacterSkeleton::get_bone_node(EntityEnums::CharacterSkeletonBoneId node_id) {
|
Node *CharacterSkeleton::get_bone_node(EntityEnums::CharacterSkeletonPoints node_id) {
|
||||||
return _bone_nodes[node_id];
|
return _bone_nodes[node_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ AnimationTree *CharacterSkeleton::get_animation_tree() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CharacterSkeleton::update_nodes() {
|
void CharacterSkeleton::update_nodes() {
|
||||||
for (int i = 0; i < EntityEnums::MAX_BONE_ID; ++i) {
|
for (int i = 0; i < EntityEnums::SKELETON_POINTS_MAX; ++i) {
|
||||||
_bone_nodes[i] = get_node_or_null(_bone_paths[i]);
|
_bone_nodes[i] = get_node_or_null(_bone_paths[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ void CharacterSkeleton::update_nodes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CharacterSkeleton::CharacterSkeleton() {
|
CharacterSkeleton::CharacterSkeleton() {
|
||||||
for (int i = 0; i < EntityEnums::MAX_BONE_ID; ++i) {
|
for (int i = 0; i < EntityEnums::SKELETON_POINTS_MAX; ++i) {
|
||||||
_bone_nodes[i] = NULL;
|
_bone_nodes[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,9 +94,15 @@ void CharacterSkeleton::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("set_bone_path", "index", "path"), &CharacterSkeleton::set_bone_path);
|
ClassDB::bind_method(D_METHOD("set_bone_path", "index", "path"), &CharacterSkeleton::set_bone_path);
|
||||||
|
|
||||||
ADD_GROUP("Bone Paths", "bone_path_");
|
ADD_GROUP("Bone Paths", "bone_path_");
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "bone_path_hip"), "set_bone_path", "get_bone_path", EntityEnums::BONE_ID_HIP);
|
ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "bone_path_hip"), "set_bone_path", "get_bone_path", EntityEnums::SKELETON_POINT_HIP);
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "bone_path_left_hand"), "set_bone_path", "get_bone_path", EntityEnums::BONE_ID_LEFT_HAND);
|
ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "bone_path_left_hand"), "set_bone_path", "get_bone_path", EntityEnums::SKELETON_POINT_LEFT_HAND);
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "bone_path_right_hand"), "set_bone_path", "get_bone_path", EntityEnums::BONE_ID_RIGHT_HAND);
|
ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "bone_path_right_hand"), "set_bone_path", "get_bone_path", EntityEnums::SKELETON_POINT_RIGHT_HAND);
|
||||||
|
ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "bone_path_weapon"), "set_bone_path", "get_bone_path", EntityEnums::SKELETON_POINT_WEAPON);
|
||||||
|
ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "bone_path_base"), "set_bone_path", "get_bone_path", EntityEnums::SKELETON_POINT_BASE);
|
||||||
|
ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "bone_path_body"), "set_bone_path", "get_bone_path", EntityEnums::SKELETON_POINT_BODY);
|
||||||
|
ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "bone_path_head"), "set_bone_path", "get_bone_path", EntityEnums::SKELETON_POINT_HEAD);
|
||||||
|
ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "bone_path_right_eye"), "set_bone_path", "get_bone_path", EntityEnums::SKELETON_POINT_RIGHT_EYE);
|
||||||
|
ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "bone_path_left_eye"), "set_bone_path", "get_bone_path", EntityEnums::SKELETON_POINT_LEFT_EYE);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_bone_node", "bone_idx"), &CharacterSkeleton::get_bone_node);
|
ClassDB::bind_method(D_METHOD("get_bone_node", "bone_idx"), &CharacterSkeleton::get_bone_node);
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public:
|
|||||||
NodePath get_bone_path(int index);
|
NodePath get_bone_path(int index);
|
||||||
void set_bone_path(int index, NodePath path);
|
void set_bone_path(int index, NodePath path);
|
||||||
|
|
||||||
Node *get_bone_node(EntityEnums::CharacterSkeletonBoneId node_id);
|
Node *get_bone_node(EntityEnums::CharacterSkeletonPoints node_id);
|
||||||
|
|
||||||
NodePath get_animation_player_path();
|
NodePath get_animation_player_path();
|
||||||
void set_animation_player_path(NodePath path);
|
void set_animation_player_path(NodePath path);
|
||||||
@ -54,12 +54,12 @@ private:
|
|||||||
NodePath _animation_player_path;
|
NodePath _animation_player_path;
|
||||||
NodePath _animation_tree_path;
|
NodePath _animation_tree_path;
|
||||||
|
|
||||||
NodePath _bone_paths[EntityEnums::MAX_BONE_ID];
|
NodePath _bone_paths[EntityEnums::SKELETON_POINTS_MAX];
|
||||||
|
|
||||||
AnimationPlayer *_animation_player;
|
AnimationPlayer *_animation_player;
|
||||||
AnimationTree *_animation_tree;
|
AnimationTree *_animation_tree;
|
||||||
|
|
||||||
Node *_bone_nodes[EntityEnums::MAX_BONE_ID];
|
Node *_bone_nodes[EntityEnums::SKELETON_POINTS_MAX];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,280 +0,0 @@
|
|||||||
#include "spell_manager.h"
|
|
||||||
|
|
||||||
SpellManager *SpellManager::_instance;
|
|
||||||
|
|
||||||
SpellManager *SpellManager::get_instance() {
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
SpellManager::SpellManager() {
|
|
||||||
SpellManager::_instance = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
SpellManager::~SpellManager() {
|
|
||||||
SpellManager::_instance = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::CastSpell(Entity *caster, int spellId, float scale) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::CastingFinished(Entity *caster, int spellId, float scale) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::UpdateAuras(Entity *ac) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::OnHit(Entity *ac, Entity *caster, Entity *target, Spell *spell, int damage) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::POnBeforeDamage(Entity *ac, SpellDamageInfo *data) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::OnDamageReceive(Entity *ac, Entity *caster, Entity *target, Spell *spell, int damage) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::RemoveAurasWithGroup(Entity *ac, int auraGroup) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::CRefreshAura(Entity *ac, int auraId, float time) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::CRefreshCasterAura(Entity *ac, int auraId, Entity *caster, float time) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::CAuraAdded(Entity *ac, int id, float remaining, Entity *caster, int casterGUID) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::CAuraRemoved(Entity *ac, int id) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::SetupOnPlayerMoves(Entity *bopmccc, Vector<int> *sspells) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::COnCastFailed(Entity *caster, int spellId) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::COnCastStarted(Entity *caster, int spellId) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::COnCastStateChanged(Entity *caster, int spellId) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::COnCastFinished(Entity *caster, int spellId) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::COnSpellCastSuccess(Entity *caster, int spellId) {
|
|
||||||
}
|
|
||||||
|
|
||||||
String SpellManager::RequestName(int spellId) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
String SpellManager::RequestDescription(int spellId, int level) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
void SpellManager::CastSpell(Entity *caster, int spellId, float scale) {
|
|
||||||
if (!Spells::Instance->SpellsDict->ContainsKey(spellId)) {
|
|
||||||
Debug::Log(*(new String("SpellManager->castSpell: SpellID Doesn't exists! spellId:")) + BOX<int>(spellId));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Spell *spell = Spells::Instance->SpellsDict->GetData(spellId);
|
|
||||||
if (spell == null) {
|
|
||||||
Debug::Log(new String("SpellManager->castSpell: SpellData is null!"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
(SpellScript *)(spell->SpellScript)->StartCasting((WorldEntity *)(caster), scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::CastingFinished(Entity *caster, int spellId, float scale) {
|
|
||||||
if (!Spells::Instance->SpellsDict->ContainsKey(spellId)) {
|
|
||||||
Debug::Log(new String("SpellManager->CastingFinished: SpellID Doesn't exists!"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Spell *spell = Spells::Instance->SpellsDict->GetData(spellId);
|
|
||||||
if (spell == null) {
|
|
||||||
Debug::Log(new String("SpellManager->CastingFinished: SpellData is null!"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
(SpellScript *)(spell->SpellScript)->CastingFinished((WorldEntity *)(caster), scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::UpdateAuras(Entity *ac) {
|
|
||||||
AuraComponent *auraComponent = as_cast<AuraComponent *>(ac);
|
|
||||||
for (int i = 0; i < auraComponent->serverAuras->Count; i += 1) {
|
|
||||||
AuraData *auraData = auraComponent->serverAuras->GetData(i);
|
|
||||||
AuraScript *auraScript = (AuraScript *)(auraData->Aura->AuraScript);
|
|
||||||
if (auraScript == null) {
|
|
||||||
Debug::Log(*(new String("AuraComponent->Update(): Aurascript is null! AuraId: ")) + BOX<int>(auraData->AuraId));
|
|
||||||
} else {
|
|
||||||
if (auraScript->AuraUpdate(auraComponent->Owner, auraData)) {
|
|
||||||
auraComponent->serverAuras->RemoveAt(i);
|
|
||||||
auraComponent->CReceiveAuraRemoved(auraData->AuraId);
|
|
||||||
i -= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::OnHit(Entity *ac, Entity *caster, Entity *target, MonoBehaviour *spell, int damage) {
|
|
||||||
AuraComponent *auraComponent = as_cast<AuraComponent *>(ac);
|
|
||||||
int count = auraComponent->serverAuras->Count;
|
|
||||||
for (int i = 0; i < auraComponent->serverAuras->Count; i += 1) {
|
|
||||||
(AuraScript *)(auraComponent->serverAuras->GetData(i)->Aura->AuraScript)->OnHit((WorldEntity *)(caster), (WorldEntity *)(target), spell, auraComponent->serverAuras->GetData(i), damage);
|
|
||||||
if (count != auraComponent->serverAuras->Count) {
|
|
||||||
i -= count - *auraComponent->serverAuras->Count;
|
|
||||||
count = auraComponent->serverAuras->Count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::POnBeforeDamage(Entity *ac, SpellDamageInfo *data) {
|
|
||||||
AuraComponent *auraComponent = as_cast<AuraComponent *>(ac);
|
|
||||||
int count = auraComponent->serverAuras->Count;
|
|
||||||
for (int i = 0; i < auraComponent->serverAuras->Count; i += 1) {
|
|
||||||
(AuraScript *)(auraComponent->serverAuras->GetData(i)->Aura->AuraScript)->POnBeforeDamage(data, auraComponent->serverAuras->GetData(i));
|
|
||||||
if (count != auraComponent->serverAuras->Count) {
|
|
||||||
i -= count - *auraComponent->serverAuras->Count;
|
|
||||||
count = auraComponent->serverAuras->Count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::OnDamageReceive(Entity *ac, Entity *caster, Entity *target, MonoBehaviour *spell, int damage) {
|
|
||||||
AuraComponent *auraComponent = as_cast<AuraComponent *>(ac);
|
|
||||||
int count = auraComponent->serverAuras->Count;
|
|
||||||
for (int i = 0; i < auraComponent->serverAuras->Count; i += 1) {
|
|
||||||
(AuraScript *)(auraComponent->serverAuras->GetData(i)->Aura->AuraScript)->OnDamageReceive((WorldEntity *)(caster), (WorldEntity *)(target), spell, auraComponent->serverAuras->GetData(i), damage);
|
|
||||||
if (count != auraComponent->serverAuras->Count) {
|
|
||||||
i -= count - *auraComponent->serverAuras->Count;
|
|
||||||
count = auraComponent->serverAuras->Count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::RemoveAurasWithGroup(Entity *ac, int auraGroup) {
|
|
||||||
AuraComponent *auraComponent = as_cast<AuraComponent *>(ac);
|
|
||||||
for (int i = 0; i < auraComponent->serverAuras->Count; i += 1) {
|
|
||||||
AuraData *auraData = auraComponent->serverAuras->GetData(i);
|
|
||||||
if (auraData->AuraGroup == auraGroup) {
|
|
||||||
(AuraScript *)(Auras::Instance->GetData(auraData->AuraId)->AuraScript)->DeApply(auraComponent->Owner, auraData);
|
|
||||||
auraComponent->serverAuras->RemoveAt(i);
|
|
||||||
i -= 1;
|
|
||||||
auraComponent->CReceiveAuraRemoved(auraData->AuraId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::CRefreshAura(Entity *ac, int auraId, float time) {
|
|
||||||
AuraComponent *auraComponent = as_cast<AuraComponent *>(ac);
|
|
||||||
for (int i = 0; i < auraComponent->auras->Count; i += 1) {
|
|
||||||
if (auraComponent->auras->GetData(i)->AuraId == auraId) {
|
|
||||||
auraComponent->auras->GetData(i)->Remaining = time;
|
|
||||||
Aura *aura = auraComponent->auras->GetData(i)->Aura;
|
|
||||||
(AuraScript *)(aura->AuraScript)->COnRefresh((WorldEntity *)(auraComponent->auras->GetData(i)->Caster), aura->gameObject, auraComponent->auras->GetData(i));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::CRefreshCasterAura(Entity *ac, int auraId, Entity *caster, float time) {
|
|
||||||
AuraComponent *auraComponent = as_cast<AuraComponent *>(ac);
|
|
||||||
for (int i = 0; i < auraComponent->auras->Count; i += 1) {
|
|
||||||
if ((auraComponent->auras->GetData(i)->AuraId == auraId) && (auraComponent->auras->GetData(i)->Caster == *caster)) {
|
|
||||||
auraComponent->auras->GetData(i)->Remaining = time;
|
|
||||||
Aura *aura = auraComponent->auras->GetData(i)->Aura;
|
|
||||||
(AuraScript *)(aura->AuraScript)->COnRefresh((WorldEntity *)(caster), aura->gameObject, auraComponent->auras->GetData(i));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::CAuraAdded(Entity *ac, int id, float remaining, Entity *caster, uint casterGUID) {
|
|
||||||
AuraComponent *arg_18_0 = as_cast<AuraComponent *>(ac);
|
|
||||||
AuraData *auraData = new AuraData(id, remaining, caster, casterGUID, 0, (float)1);
|
|
||||||
arg_18_0->auras->Add(auraData);
|
|
||||||
Aura *aura = Auras::Instance->GetData(id);
|
|
||||||
(AuraScript *)(aura->AuraScript)->COnAdded((WorldEntity *)(caster), aura, auraData);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::CAuraRemoved(Entity *ac, int id) {
|
|
||||||
AuraComponent *auraComponent = as_cast<AuraComponent *>(ac);
|
|
||||||
for (int i = 0; i < auraComponent->auras->Count; i += 1) {
|
|
||||||
if (auraComponent->auras->GetData(i)->AuraId == id) {
|
|
||||||
auraComponent->auras->RemoveAt(i);
|
|
||||||
Aura *aura = Auras::Instance->GetData(id);
|
|
||||||
(AuraScript *)(aura->AuraScript)->COnRemoved(auraComponent->Owner, aura);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::SetupOnPlayerMoves(BaseOnPlayerMoveCallbackComponent *bopmccc, List_T<int> *sspells) {
|
|
||||||
OnPlayerMoveCallbackComponent *onPlayerMoveCallbackComponent = as_cast<OnPlayerMoveCallbackComponent *>(bopmccc);
|
|
||||||
for (int i = 0; i < sspells->Count; i += 1) {
|
|
||||||
BaseOnPlayerMoveCallbackComponent *arg_38_0 = onPlayerMoveCallbackComponent;
|
|
||||||
SpellScript *expr_2C = (SpellScript *)(Spells::Instance->SpellsDict->GetData(sspells->GetData(i))->SpellScript);
|
|
||||||
arg_38_0->SOnPlayerMove += *(new BaseOnPlayerMoveCallbackComponent::OnPlayerMoved(expr_2C->OnPlayerMove));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::COnCastFailed(Entity *caster, int spellId) {
|
|
||||||
Spell *spell;
|
|
||||||
if (!Spells::Instance->SpellsDict->TryGetValue(spellId, spell)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
(SpellScript *)(spell->SpellScript)->COnSpellCastEnded((WorldEntity *)(caster));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::COnCastStarted(Entity *caster, int spellId) {
|
|
||||||
Spell *spell;
|
|
||||||
if (!Spells::Instance->SpellsDict->TryGetValue(spellId, spell)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
(SpellScript *)(spell->SpellScript)->COnSpellCastStarted((WorldEntity *)(caster));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::COnCastStateChanged(Entity *caster, int spellId) {
|
|
||||||
Spell *spell;
|
|
||||||
if (!Spells::Instance->SpellsDict->TryGetValue(spellId, spell)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
(SpellScript *)(spell->SpellScript)->OnCastStateChanged((WorldEntity *)(caster));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::COnCastFinished(Entity *caster, int spellId) {
|
|
||||||
Spell *spell;
|
|
||||||
if (!Spells::Instance->SpellsDict->TryGetValue(spellId, spell)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
(SpellScript *)(spell->SpellScript)->COnSpellCastEnded((WorldEntity *)(caster));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellManager::COnSpellCastSuccess(Entity *caster, int spellId) {
|
|
||||||
Spell *spell;
|
|
||||||
if (!Spells::Instance->SpellsDict->TryGetValue(spellId, spell)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
(SpellScript *)(spell->SpellScript)->COnSpellCastSuccess((WorldEntity *)(caster));
|
|
||||||
}
|
|
||||||
|
|
||||||
String SpellManager::RequestName(int spellId) {
|
|
||||||
Spell *spell;
|
|
||||||
if (!Spells::Instance->SpellsDict->TryGetValue(spellId, spell)) {
|
|
||||||
return new String("");
|
|
||||||
}
|
|
||||||
return (SpellScript *)(spell->SpellScript)->GetName();
|
|
||||||
}
|
|
||||||
|
|
||||||
String SpellManager::RequestDescription(int spellId, int level) {
|
|
||||||
Spell *spell;
|
|
||||||
if (!Spells::Instance->SpellsDict->TryGetValue(spellId, spell)) {
|
|
||||||
return new String("");
|
|
||||||
}
|
|
||||||
return (SpellScript *)(spell->SpellScript)->GetDescription(level);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
void SpellManager::_bind_methods() {
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
#ifndef SPELL_MANAGER_H
|
|
||||||
#define SPELL_MANAGER_H
|
|
||||||
|
|
||||||
#include "scene/main/node.h"
|
|
||||||
#include "core/ustring.h"
|
|
||||||
#include "core/vector.h"
|
|
||||||
#include "../pipelines/spell_damage_info.h"
|
|
||||||
#include "../entities/entity.h"
|
|
||||||
#include "../data/spell.h"
|
|
||||||
|
|
||||||
//Deprecated, delete later
|
|
||||||
|
|
||||||
class SpellManager : public Node {
|
|
||||||
GDCLASS(SpellManager, Node);
|
|
||||||
|
|
||||||
public:
|
|
||||||
static SpellManager *get_instance();
|
|
||||||
|
|
||||||
void CastSpell(Entity *caster, int spellId, float scale);
|
|
||||||
void CastingFinished(Entity *caster, int spellId, float scale);
|
|
||||||
void UpdateAuras(Entity *auraComponent);
|
|
||||||
void OnHit(Entity *auraComponent, Entity *caster, Entity *target, Spell *spell, int damage);
|
|
||||||
void POnBeforeDamage(Entity *ac, SpellDamageInfo *data);
|
|
||||||
void OnDamageReceive(Entity *ac, Entity *caster, Entity *target, Spell *spell, int damage);
|
|
||||||
void RemoveAurasWithGroup(Entity *ac, int auraGroup);
|
|
||||||
void CRefreshAura(Entity *ac, int auraId, float time);
|
|
||||||
void CRefreshCasterAura(Entity *ac, int auraId, Entity *caster, float time);
|
|
||||||
void CAuraAdded(Entity *ac, int id, float remaining, Entity *caster, int casterGUID);
|
|
||||||
void CAuraRemoved(Entity *ac, int id);
|
|
||||||
void COnCastFailed(Entity *caster, int spellId);
|
|
||||||
void SetupOnPlayerMoves(Entity *bopmccc, Vector<int> *sspells);
|
|
||||||
void COnCastStarted(Entity *caster, int spellId);
|
|
||||||
void COnCastStateChanged(Entity *caster, int spellId);
|
|
||||||
void COnCastFinished(Entity *caster, int spellId);
|
|
||||||
void COnSpellCastSuccess(Entity *caster, int spellId);
|
|
||||||
|
|
||||||
String RequestName(int spellId);
|
|
||||||
String RequestDescription(int spellId, int level);
|
|
||||||
|
|
||||||
SpellManager();
|
|
||||||
~SpellManager();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
static void _bind_methods();
|
|
||||||
|
|
||||||
private:
|
|
||||||
static SpellManager *_instance;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue
Block a user