60 #include "utils/timer.h"
77 else if (str ==
"mercenary")
79 else if (str ==
"homunculus")
158 const std::string &eventId =
event.getId();
159 if (eventId ==
"inc")
171 else if (eventId ==
"sel")
199 else if (eventId ==
"use")
210 info->customSelectedLevel,
211 info->useTextParameter,
213 info->customCastType,
215 info->customOffsetY);
218 else if (eventId ==
"close")
226 const SkillMap::const_iterator i =
mSkills.find(
id);
234 return info->data->name;
238 return std::string();
261 !
info->data->autoTab)
286 std::set<SkillModel*> models;
294 if (model !=
nullptr)
295 models.insert(model);
298 FOR_EACH (std::set<SkillModel*>::iterator, it, models)
301 if (model !=
nullptr)
308 std::set<SkillModel*> models;
318 if (model !=
nullptr)
319 models.insert(model);
323 FOR_EACH (std::set<SkillModel*>::iterator, it, models)
326 if (model !=
nullptr)
348 if ((
info !=
nullptr) &&
info->owner == owner)
376 XmlNodePtrConst root = doc.
rootNode();
380 if ((root ==
nullptr) || !xmlNameEqual(root,
"skills"))
388 if (xmlNameEqual(set,
"include"))
395 else if (xmlNameEqual(set,
"set"))
404 if (setTypeStr.empty() ||
405 setTypeStr ==
"list" ||
406 setTypeStr ==
"vertical")
410 else if (setTypeStr ==
"rectangle")
415 bool alwaysVisible =
false;
435 tab =
new SkillTab(
this, setName, listbox);
451 tab =
new SkillTab(
this, setName, listbox);
466 if (alwaysVisible ==
true)
474 if (xmlNameEqual(node,
"skill"))
477 if (
skill ==
nullptr)
480 alwaysVisible =
true;
484 if (!xmlNameEqual(levelNode,
"level"))
509 if (
skill ==
nullptr)
518 skill->model = model;
522 node,
"useButton",
_(
"Use"));
524 node,
"owner",
"player"));
526 node,
"errorText", name);
528 node,
"alwaysVisible",
false),
Visible);
538 node,
"useTextParameter",
false);
555 if (
skill ==
nullptr)
571 data->haveIcon =
false;
576 data->haveIcon =
true;
591 "shortName", name.substr(0, 3));
593 node,
"description",
"");
597 node,
"missile-particle",
"");
599 node,
"missile-z", 32.0F);
601 node,
"missile-lifetime", 500);
603 node,
"missile-speed", 7.0F);
605 node,
"missile-diedistance", 8.0F);
609 node,
"castingMissile-particle",
"");
611 node,
"castingMissile-z", 32.0F);
613 node,
"castingMissile-lifetime", 500);
615 node,
"castingMissile-speed", 7.0F);
617 node,
"castingMissile-diedistance", 8.0F);
625 node,
"soundHit",
"");
627 node,
"soundHitDelay", 0);
629 node,
"soundMiss",
"");
631 node,
"soundMissDelay", 0);
633 node,
"invokeCmd",
"");
635 node,
"levelUpEffectId", -1);
637 node,
"removeEffectId", -1);
639 node,
"hitEffectId", -1);
641 node,
"missEffectId", -1);
643 node,
"castingSrcEffectId", -1);
645 node,
"castingDstEffectId", -1);
647 node,
"srcEffectId", -1);
649 node,
"dstEffectId", -1);
651 node,
"castingGroundEffectId", -1);
653 node,
"autoTab",
true);
660 const SkillMap::const_iterator it =
mSkills.find(
id);
682 const SkillMap::const_iterator it =
mSkills.find(
id);
689 info->modifiable = modifiable;
694 if (
info->tab !=
nullptr)
740 const std::string &name,
752 skill->owner = owner;
764 data->description.clear();
769 data->haveIcon =
false;
774 data->haveIcon =
true;
778 skill->modifiable = modifiable;
782 skill->level = level;
785 skill->range = range;
789 skill->useButton =
_(
"Use");
805 SkillMap::const_iterator it =
mSkills.find(
id);
823 SkillMap::const_iterator it =
mSkills.find(
id);
836 info->duration = duration;
846 if (
mTabs !=
nullptr)
853 const std::string &
data)
const
855 const std::map<int, SkillInfo*>::const_iterator
867 STD_VECTOR<int> vect;
869 const size_t sz = vect.size();
871 castType =
static_cast<CastTypeT>(vect[0]);
916 const SkillMap::const_iterator it =
mSkills.find(
id);
932 const SkillMap::const_iterator it =
mSkills.find(
id);
943 const int level)
const
945 const SkillMap::const_iterator it =
mSkills.find(
id);
950 return info->getData1(level);
983 const int delay)
const
1000 const bool withText,
1001 const std::string &text,
1007 if (
info ==
nullptr)
1010 castType =
info->customCastType;
1024 const bool withText,
1025 const std::string &text,
1033 level =
info->level;
1036 if (
data !=
nullptr)
1038 const std::string cmd =
data->invokeCmd;
1099 const bool withText,
1100 const std::string &text,
1116 if (being !=
nullptr)
1125 if (being ==
nullptr)
1127 if (being !=
nullptr)
1142 if (being ==
nullptr)
1145 const int x = being->
getTileX() + offsetX;
1146 const int y = being->
getTileY() + offsetY;
1147 if (
info->useTextParameter)
1166 data->name.c_str()),
1201 const bool withText,
1202 const std::string &text,
1212 if (
info->useTextParameter)
1232 data->name.c_str()),
1287 const bool withText,
1288 const std::string &text,
1301 if (being !=
nullptr)
1311 if (being ==
nullptr)
1313 if (being !=
nullptr)
1334 if (
info->useTextParameter)
1353 data->name.c_str()),
1388 if (
skill ==
nullptr)
1393 if ((*it)->id ==
skill->id)
1404 if (
skill !=
nullptr)
1407 if (time >=
skill->duration)
1410 skill->cooldown = 0;
1411 skill->duration = 0;
1412 skill->durationTime = 0;
1420 skill->cooldown =
skill->duration * 100 / time;
1430 if (
info ==
nullptr)
1432 if (level >
info->level)
1433 info->customSelectedLevel =
info->level;
1435 info->customSelectedLevel = level;
1443 if (
info ==
nullptr)
1445 info->customCastType = type;
1453 if (
info ==
nullptr)
1455 info->customOffsetX = offset;
1463 if (
info ==
nullptr)
1465 info->customOffsetY = offset;
const bool AllowSort_true
const bool AutoTarget_true
#define loadXmlDir(name, function)
#define fromBool(val, name)
#define reportAlways(...)
void fixDirectionOffsets(int &offsetX, int &offsetY) const
bool getBoolValue(const std::string &key) const
std::string getStringValue(const std::string &key) const
int getIntValue(const std::string &key) const
void triggerDefault(int effectId, Being *const being, const int defaultEffectId)
void setItemFast(const size_t index, const int item, const ItemColor color)
void setItemSelected(const int itemId)
void setItemData(const size_t index, const std::string &data)
void setCaption(const std::string &caption)
Being * getTarget() const
Being * setNewTarget(const ActorTypeT type, const AllowSort allowSort)
void log(const char *const log_text,...)
virtual void increaseSkill(const uint16_t skillId) const =0
virtual void useBeing(const int id, const int level, const BeingId beingId) const =0
virtual void usePos(const int id, const int level, const int x, const int y) const =0
bool unknownSkillsAutoTab
void registerWindowForReset(Window *const window)
static void useSkillDefault(const SkillInfo *const info, const AutoTarget autoTarget, int level, const bool withText, const std::string &text, int offsetX, int offsetY)
void setSkillDuration(const SkillOwner::Type owner, const int id, const int duration)
void selectSkillLevel(const int skillId, const int level)
SkillData * getSkillData(const int id) const
void setSkillOffsetY(const int skillId, const int offset)
SkillModel * mDefaultModel
void updateQuest(const int var, const int val1, const int val2, const int val3, const int time1)
std::vector< SkillInfo * > mDurations
void selectSkillCastType(const int skillId, const CastTypeT type)
SkillInfo * loadSkill(const xmlNodePtr node, SkillModel *const model)
SkillInfo * getSkill(const int id) const
bool updateSkill(const int id, const int range, const Modifiable modifiable, const SkillType::SkillType type, const int sp)
std::list< Tab * > mDeleteTabs
SkillInfo * getSkillByItem(const int itemId) const
void updateTabSelection()
void widgetResized(const Event &event)
void playRemoveEffect(const int id) const
void updateModelsHidden()
void action(const ActionEvent &event)
void removeSkill(const int id)
void playCastingDstTileEffect(const int id, const int level, const int x, const int y, const int delay) const
void playUpdateEffect(const int id) const
static void loadSkillData(const xmlNodePtr node, SkillInfo *const skill)
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)
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 addSkillDuration(SkillInfo *const skill)
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 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 useItem(const int itemId, const AutoTarget autoTarget, const int level, const std::string &data) const
void setSkillOffsetX(const int skillId, const int offset)
SkillData * getSkillDataByLevel(const int id, const int level) const
static std::string getDefaultSkillIcon(const SkillType::SkillType type)
void loadXmlFile(const std::string &fileName, const SkipError skipError)
void hideSkills(const SkillOwner::Type owner)
void updateVisibilities()
void addSkill(SkillInfo *const info)
SkillInfo * getSelectedInfo() const
static void invokeCommand(const std::string &command, const Being *const target)
void setSelectedTabDefault()
Widget * getTabContainer() const
void adjustTabPositions()
void removeAll(const bool del)
Widget * getWidgetContainer() const
void addTab(Tab *const tab, Widget *const widget)
Tab * getSelectedTab() const
void setDialog(TextDialog *dialog)
void setSkill(const int skillId, const int x, const int y, const int level)
void getMouseTile(int &destX, int &destY) const
void setSaveVisible(const bool save)
void setResizable(const bool resize)
virtual void setVisible(Visible visible)
void setWindowName(const std::string &name)
void setModal(const Modal modal)
void enableVisibleSound(bool b)
void widgetResized(const Event &event)
void setCloseButton(const bool flag)
void setStickyButtonLock(const bool sticky)
LayoutCell & place(const int x, const int y, Widget *const wg, const int w, const int h)
void setLocationRelativeTo(const Widget *const widget)
const size_t SHORTCUT_AUTO_TAB
const unsigned int SHORTCUT_ITEMS
const unsigned int SHORTCUT_TABS
void delete_all(Container &c)
EffectManager * effectManager
#define FOR_EACH_SAFE(type, iter, array)
#define FOR_EACH(type, iter, array)
#define fromInt(val, name)
ItemShortcut * itemShortcut[SHORTCUT_TABS]
#define for_each_xml_child_node(var, parent)
LocalPlayer * localPlayer
const bool Modifiable_true
const bool Modifiable_false
bool info(InputEvent &event)
bool skill(InputEvent &event)
std::string toString(T const &value)
converts any type to a string
int32_t getAttribute(const AttributesT id)
void setSkillLevel(const int id, const int value)
static const std::string CASTSKY("castsky")
static const std::string CASTWATER("castwater")
static const std::string CASTRIDE("castride")
static const std::string CAST("cast")
std::string langProperty(const xmlNodePtr node, const char *const name, const std::string &def)
float getFloatProperty(const xmlNodePtr node, const char *const name, float def)
bool getBoolProperty(const xmlNodePtr node, const char *const name, const bool def)
int getProperty(const xmlNodePtr node, const char *const name, int def)
int getIntProperty(const xmlNodePtr node, const char *const name, int def, const int min, const int max)
TextSkillListener textSkillListener
Net::SkillHandler * skillHandler
Net::PlayerHandler * playerHandler
const unsigned int SKILL_VAR_MIN_ID
SetupWindow * setupWindow
ShortcutWindow * itemShortcutWindow
static SkillOwner::Type parseOwner(const std::string &str)
SkillDialog * skillDialog
SkillSetType ::T SkillSetTypeT
const bool SkipError_false
const bool SkipError_true
void splitToIntVector(std::vector< int > &tokens, const std::string &text, const char separator)
std::string strprintf(const char *const format,...)
int get_elapsed_time(const int startTime)
const bool UseVirtFs_true
WindowContainer * windowContainer