59 #include "utils/timer.h" 76 else if (str ==
"mercenary")
78 else if (str ==
"homunculus")
157 const std::string &eventId =
event.getId();
158 if (eventId ==
"inc")
170 else if (eventId ==
"sel")
198 else if (eventId ==
"use")
217 else if (eventId ==
"close")
225 const SkillMap::const_iterator i =
mSkills.find(
id);
237 return std::string();
285 std::set<SkillModel*> models;
293 if (model !=
nullptr)
294 models.insert(model);
297 FOR_EACH (std::set<SkillModel*>::iterator, it, models)
300 if (model !=
nullptr)
307 std::set<SkillModel*> models;
317 if (model !=
nullptr)
318 models.insert(model);
322 FOR_EACH (std::set<SkillModel*>::iterator, it, models)
325 if (model !=
nullptr)
347 if ((info !=
nullptr) && info->
owner == owner)
375 XmlNodePtrConst root = doc.
rootNode();
379 if ((root ==
nullptr) || !xmlNameEqual(root,
"skills"))
381 logger->
log(
"Error loading skills: " + fileName);
387 if (xmlNameEqual(
set,
"include"))
394 else if (xmlNameEqual(
set,
"set"))
403 if (setTypeStr.empty() ||
404 setTypeStr ==
"list" ||
405 setTypeStr ==
"vertical")
409 else if (setTypeStr ==
"rectangle")
414 bool alwaysVisible =
false;
434 tab =
new SkillTab(
this, setName, listbox);
450 tab =
new SkillTab(
this, setName, listbox);
465 if (alwaysVisible ==
true)
473 if (xmlNameEqual(node,
"skill"))
476 if (skill ==
nullptr)
479 alwaysVisible =
true;
483 if (!xmlNameEqual(levelNode,
"level"))
508 if (skill ==
nullptr)
521 node,
"useButton",
_(
"Use"));
523 node,
"owner",
"player"));
525 node,
"errorText", name);
527 node,
"alwaysVisible",
false),
Visible);
537 node,
"useTextParameter",
false);
554 if (skill ==
nullptr)
590 "shortName", name.substr(0, 3));
592 node,
"description",
"");
596 node,
"missile-particle",
"");
598 node,
"missile-z", 32.0F);
600 node,
"missile-lifetime", 500);
602 node,
"missile-speed", 7.0F);
604 node,
"missile-diedistance", 8.0F);
608 node,
"castingMissile-particle",
"");
610 node,
"castingMissile-z", 32.0F);
612 node,
"castingMissile-lifetime", 500);
614 node,
"castingMissile-speed", 7.0F);
616 node,
"castingMissile-diedistance", 8.0F);
624 node,
"soundHit",
"");
626 node,
"soundHitDelay", 0);
628 node,
"soundMiss",
"");
630 node,
"soundMissDelay", 0);
632 node,
"invokeCmd",
"");
634 node,
"levelUpEffectId", -1);
636 node,
"removeEffectId", -1);
638 node,
"hitEffectId", -1);
640 node,
"missEffectId", -1);
642 node,
"castingSrcEffectId", -1);
644 node,
"castingDstEffectId", -1);
646 node,
"srcEffectId", -1);
648 node,
"dstEffectId", -1);
650 node,
"castingGroundEffectId", -1);
652 node,
"autoTab",
true);
659 const SkillMap::const_iterator it =
mSkills.find(
id);
681 const SkillMap::const_iterator it =
mSkills.find(
id);
693 if (info->
tab !=
nullptr)
739 const std::string &name,
751 skill->
owner = owner;
781 skill->
level = level;
784 skill->
range = range;
804 SkillMap::const_iterator it =
mSkills.find(
id);
822 SkillMap::const_iterator it =
mSkills.find(
id);
845 if (
mTabs !=
nullptr)
852 const std::string &
data)
const 854 const std::map<int, SkillInfo*>::const_iterator
866 STD_VECTOR<int> vect;
868 const size_t sz = vect.size();
870 castType =
static_cast<CastTypeT>(vect[0]);
911 const int val3 A_UNUSED,
912 const int time1 A_UNUSED)
915 const SkillMap::const_iterator it =
mSkills.find(
id);
931 const SkillMap::const_iterator it =
mSkills.find(
id);
942 const int level)
const 944 const SkillMap::const_iterator it =
mSkills.find(
id);
982 const int delay)
const 1000 const std::string &text,
1006 if (info ==
nullptr)
1023 const bool withText,
1024 const std::string &text,
1029 if ((info ==
nullptr) || (
localPlayer ==
nullptr))
1032 level = info->
level;
1035 if (data !=
nullptr)
1037 const std::string cmd = data->
invokeCmd;
1098 const bool withText,
1099 const std::string &text,
1115 if (being !=
nullptr)
1124 if (being ==
nullptr)
1126 if (being !=
nullptr)
1141 if (being ==
nullptr)
1144 const int x = being->
getTileX() + offsetX;
1145 const int y = being->
getTileY() + offsetY;
1165 data->
name.c_str()),
1200 const bool withText,
1201 const std::string &text,
1231 data->
name.c_str()),
1286 const bool withText,
1287 const std::string &text,
1300 if (being !=
nullptr)
1310 if (being ==
nullptr)
1312 if (being !=
nullptr)
1352 data->
name.c_str()),
1387 if (skill ==
nullptr)
1392 if ((*it)->id == skill->
id)
1403 if (skill !=
nullptr)
1429 if (info ==
nullptr)
1431 if (level > info->
level)
1442 if (info ==
nullptr)
1452 if (info ==
nullptr)
1462 if (info ==
nullptr)
Net::PlayerHandler * playerHandler
const bool AutoTarget_true
void adjustTabPositions()
#define FOR_EACH(type, iter, array)
LayoutCell & place(const int x, const int y, Widget *const wg, const int w, const int h)
std::string getStringValue(const std::string &key) const
int castingGroundEffectId
const bool SkipError_false
void removeAll(const bool del)
void addSkill(SkillInfo *const info)
void setItemSelected(const int itemId)
Being * setNewTarget(const ActorTypeT type, const AllowSort allowSort)
const bool Modifiable_true
bool skill(InputEvent &event)
void useItem(const int itemId, const AutoTarget autoTarget, const int level, const std::string &data) const
virtual void increaseSkill(const uint16_t skillId) const =0
static std::string getDefaultSkillIcon(const SkillType::SkillType type)
float getFloatProperty(const xmlNodePtr node, const char *const name, float def)
SkillInfo * getSkillByItem(const int itemId) const
static const std::string CASTRIDE("castride")
SkillSetType ::T SkillSetTypeT
void updateTabSelection()
WindowContainer * windowContainer
void setSkillOffsetX(const int skillId, const int offset)
SkillData * getData(const int level) const
#define fromInt(val, name)
void loadXmlFile(const std::string &fileName, const SkipError skipError)
bool updateSkill(const int id, const int range, const Modifiable modifiable, const SkillType::SkillType type, const int sp)
static SkillOwner::Type parseOwner(const std::string &str)
void removeSkill(const int id)
std::string castingWaterAction
int getProperty(const xmlNodePtr node, const char *const name, int def)
const unsigned int SKILL_VAR_MIN_ID
const size_t SHORTCUT_AUTO_TAB
int getIntValue(const std::string &key) const
void loadSkillData(const xmlNodePtr node, SkillInfo *const skill)
void setSkillDuration(const SkillOwner::Type owner, const int id, const int duration)
void updateVisibilities()
SkillInfo * getSelectedInfo() const
const bool AllowSort_true
std::string castingRideAction
void setSkill(const int skillId, const int x, const int y, const int level)
static void useSkillTarget(const SkillInfo *const info, const AutoTarget autoTarget, int level, const bool withText, const std::string &text, const Being *being, int offsetX, int offsetY)
void playCastingDstTileEffect(const int id, const int level, const int x, const int y, const int delay) const
void setItemData(const size_t index, const std::string &data)
void hideSkills(const SkillOwner::Type owner)
void registerWindowForReset(Window *const window)
#define loadXmlDir(name, function)
std::string castingAnimation
int get_elapsed_time(const int startTime)
SkillData * getSkillDataByLevel(const int id, const int level) const
void updateModelsHidden()
std::string toDataStr() const
int getIntProperty(const xmlNodePtr node, const char *const name, int def, const int min, const int max)
Widget * getWidgetContainer() const
void widgetResized(const Event &event)
void triggerDefault(int effectId, Being *const being, const int defaultEffectId)
SkillInfo * getSkill(const int id) const
void setDialog(TextDialog *dialog)
const bool UseVirtFs_true
bool getBoolValue(const std::string &key) const
Net::SkillHandler * skillHandler
std::string castingAction
static const std::string CASTWATER("castwater")
Widget * getTabContainer() const
std::string strprintf(const char *const format,...)
void delete_all(Container &c)
void setCaption(const std::string &caption)
SkillInfo * loadSkill(const xmlNodePtr node, SkillModel *const model)
#define fromBool(val, name)
bool info(InputEvent &event)
bool getBoolProperty(const xmlNodePtr node, const char *const name, const bool def)
static const std::string CAST("cast")
void selectSkillLevel(const int skillId, const int level)
LocalPlayer * localPlayer
void setSelectedTabDefault()
bool unknownSkillsAutoTab
SkillModel * mDefaultModel
std::list< Tab * > mDeleteTabs
static const std::string CASTSKY("castsky")
MissileInfo castingMissile
ShortcutWindow * itemShortcutWindow
void setIcon(const std::string &iconPath)
const unsigned int SHORTCUT_TABS
void setCloseButton(const bool flag)
void setSkillOffsetY(const int skillId, const int offset)
void playUpdateEffect(const int id) const
TextSkillListener textSkillListener
void widgetResized(const Event &event)
const bool Modifiable_false
ItemShortcut * itemShortcut[SHORTCUT_TABS]
void setSkillLevel(const int id, const int value)
void enableVisibleSound(bool b)
std::string castingSkyAction
void getMouseTile(int &destX, int &destY) const
void action(const ActionEvent &event)
void addSkillDuration(SkillInfo *const skill)
void fixDirectionOffsets(int &offsetX, int &offsetY) const
void selectSkillCastType(const int skillId, const CastTypeT type)
#define FOR_EACH_SAFE(type, iter, array)
virtual void useBeing(const int id, const int level, const BeingId beingId) const =0
static void useSkillPosition(const SkillInfo *const info, int level, const bool withText, const std::string &text, const int x, const int y, int offsetX, int offsetY)
void addData(const int level, SkillData *const data)
void setSaveVisible(const bool save)
SkillData * getData1(const int level) const
void setItemFast(const size_t index, const int item, const ItemColor color)
SkillDialog * skillDialog
std::string toString(T const &value)
converts any type to a string
std::string langProperty(const xmlNodePtr node, const char *const name, const std::string &def)
virtual void usePos(const int id, const int level, const int x, const int y) const =0
static void useSkill(const int skillId, const AutoTarget autoTarget, int level, const bool withText, const std::string &text, CastTypeT castType, const int offsetX, const int offsetY)
virtual void setVisible(Visible visible)
#define for_each_xml_child_node(var, parent)
Tab * getSelectedTab() const
void addSkill(const SkillOwner::Type owner, const int id, const std::string &name, const int level, const int range, const Modifiable modifiable, const SkillType::SkillType type, const int sp)
void setResizable(const bool resize)
void setStickyButtonLock(const bool sticky)
SetupWindow * setupWindow
static void invokeCommand(const std::string &command, const Being *const target)
void splitToIntVector(std::vector< int > &tokens, const std::string &text, const char separator)
void log(const char *const log_text,...)
std::vector< SkillInfo * > mDurations
const bool SkipError_true
SkillType::SkillType type
int32_t getAttribute(const AttributesT id)
void updateQuest(const int var, const int val1, const int val2, const int val3, const int time1)
SkillData * getSkillData(const int id) const
void playRemoveEffect(const int id) const
EffectManager * effectManager
#define reportAlways(...)
static void useSkillDefault(const SkillInfo *const info, const AutoTarget autoTarget, int level, const bool withText, const std::string &text, int offsetX, int offsetY)
void setLocationRelativeTo(const Widget *const widget)
void setModal(const Modal modal)
const unsigned int SHORTCUT_ITEMS
Being * getTarget() const
void addTab(Tab *const tab, Widget *const widget)
void setWindowName(const std::string &name)