ManaPlus
skilldialog.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2004-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2018 The ManaPlus Developers
6  *
7  * This file is part of The ManaPlus Client.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
24 
25 #include "configuration.h"
26 #include "effectmanager.h"
27 #include "spellmanager.h"
28 
29 #include "being/localplayer.h"
30 #include "being/playerinfo.h"
31 
33 
35 
37 
40 
41 #include "gui/widgets/button.h"
43 #include "gui/widgets/label.h"
44 #include "gui/widgets/scrollarea.h"
45 #include "gui/widgets/tabbedarea.h"
46 
48 
49 #include "gui/windows/textdialog.h"
50 
52 
53 #include "net/playerhandler.h"
54 #include "net/skillhandler.h"
55 
56 #include "utils/checkutils.h"
57 #include "utils/dtor.h"
58 #include "utils/gettext.h"
59 #include "utils/timer.h"
60 
61 #include "resources/beingcommon.h"
62 
63 #include "debug.h"
64 
66 
67 namespace
68 {
70 } // namespace
71 
72 static SkillOwner::Type parseOwner(const std::string &str)
73 {
74  if (str == "player")
75  return SkillOwner::Player;
76  else if (str == "mercenary")
77  return SkillOwner::Mercenary;
78  else if (str == "homunculus")
80  return SkillOwner::Player;
81 }
82 
84  // TRANSLATORS: skills dialog name
85  Window(_("Skills"), Modal_false, nullptr, "skills.xml"),
87  mSkills(),
88  mDurations(),
89  mTabs(CREATEWIDGETR(TabbedArea, this)),
90  mDeleteTabs(),
91  mPointsLabel(new Label(this, "0")),
92  // TRANSLATORS: skills dialog button
93  mUseButton(new Button(this, _("Use"), "use", BUTTON_SKIN, this)),
94  // TRANSLATORS: skills dialog button
95  mIncreaseButton(new Button(this, _("Up"), "inc", BUTTON_SKIN, this)),
96  mDefaultModel(nullptr),
97  mDefaultTab(nullptr)
98 {
99  setWindowName("Skills");
100  setCloseButton(true);
101  setResizable(true);
102  setSaveVisible(true);
103  setStickyButtonLock(true);
104  setDefaultSize(windowContainer->getWidth() - 280, 30, 275, 425);
105  if (setupWindow != nullptr)
107 
108  mUseButton->setEnabled(false);
109  mIncreaseButton->setEnabled(false);
110  mTabs->setSelectable(false);
113 
114  place(0, 0, mTabs, 5, 5);
115  place(0, 5, mPointsLabel, 4, 1);
116  place(3, 5, mUseButton, 1, 1);
117  place(4, 5, mIncreaseButton, 1, 1);
118 }
119 
121 {
124  loadWindowState();
125  enableVisibleSound(true);
126 }
127 
129 {
130  clearSkills();
131 }
132 
134 {
136  SkillListBox *const listbox = new SkillListBox(this,
137  mDefaultModel);
138  listbox->setActionEventId("sel");
139  listbox->addActionListener(this);
140  ScrollArea *const scroll = new ScrollArea(this,
141  listbox,
142  Opaque_false,
143  std::string());
146  // TRANSLATORS: unknown skills tab name
147  mDefaultTab = new SkillTab(this, _("Unknown"), listbox);
148  mDeleteTabs.push_back(mDefaultTab);
150  mTabs->addTab(mDefaultTab, scroll);
153 }
154 
156 {
157  const std::string &eventId = event.getId();
158  if (eventId == "inc")
159  {
160  if (playerHandler == nullptr)
161  return;
162  const SkillTab *const tab = static_cast<const SkillTab *>(
163  mTabs->getSelectedTab());
164  if (tab != nullptr)
165  {
166  if (const SkillInfo *const info = tab->getSelectedInfo())
168  }
169  }
170  else if (eventId == "sel")
171  {
172  const SkillTab *const tab = static_cast<const SkillTab *>(
173  mTabs->getSelectedTab());
174  if (tab != nullptr)
175  {
176  if (const SkillInfo *const info = tab->getSelectedInfo())
177  {
178  mUseButton->setEnabled(info->isUsable());
179  mUseButton->setCaption(info->useButton);
181  const int num = itemShortcutWindow->getTabIndex();
182  if (num >= 0 && num < CAST_S32(SHORTCUT_TABS)
183  && (itemShortcut[num] != nullptr))
184  {
186  info->id + SKILL_MIN_ID);
187  }
188  }
189  else
190  {
191  mUseButton->setEnabled(false);
192  mIncreaseButton->setEnabled(false);
193  // TRANSLATORS: skills dialog button
194  mUseButton->setCaption(_("Use"));
195  }
196  }
197  }
198  else if (eventId == "use")
199  {
200  const SkillTab *const tab = static_cast<const SkillTab *>(
201  mTabs->getSelectedTab());
202  if (tab != nullptr)
203  {
204  const SkillInfo *const info = tab->getSelectedInfo();
205  if (info == nullptr)
206  return;
207  useSkill(info,
208  fromBool(config.getBoolValue("skillAutotarget"), AutoTarget),
209  info->customSelectedLevel,
210  info->useTextParameter,
211  std::string(),
212  info->customCastType,
213  info->customOffsetX,
214  info->customOffsetY);
215  }
216  }
217  else if (eventId == "close")
218  {
220  }
221 }
222 
223 std::string SkillDialog::update(const int id)
224 {
225  const SkillMap::const_iterator i = mSkills.find(id);
226 
227  if (i != mSkills.end())
228  {
229  SkillInfo *const info = i->second;
230  if (info != nullptr)
231  {
232  info->update();
233  return info->data->name;
234  }
235  }
236 
237  return std::string();
238 }
239 
241 {
242  // TRANSLATORS: skills dialog label
243  mPointsLabel->setCaption(strprintf(_("Skill points available: %d"),
246 
247  ItemShortcut *const shortcuts = itemShortcut[SHORTCUT_AUTO_TAB];
248  shortcuts->clear();
249  size_t idx = 0;
250 
251  FOR_EACH (SkillMap::const_iterator, it, mSkills)
252  {
253  SkillInfo *const info = (*it).second;
254  if (info == nullptr)
255  continue;
256  if (info->modifiable == Modifiable_true)
257  info->update();
258  if (info->visible == Visible_false ||
259  idx >= SHORTCUT_ITEMS ||
260  !info->data->autoTab)
261  {
262  continue;
263  }
264  const SkillType::SkillType type = info->type;
265  if (type == SkillType::Attack ||
266  type == SkillType::Ground ||
267  type == SkillType::Self ||
268  type == SkillType::Support)
269  {
270  shortcuts->setItemFast(idx,
271  info->id + SKILL_MIN_ID,
273 
274  shortcuts->setItemData(idx,
275  info->toDataStr());
276  idx ++;
277  }
278  }
279 
280  skillPopup->reset();
281 }
282 
284 {
285  std::set<SkillModel*> models;
286 
287  FOR_EACH (SkillMap::const_iterator, it, mSkills)
288  {
289  SkillInfo *const info = (*it).second;
290  if (info != nullptr)
291  {
292  SkillModel *const model = info->model;
293  if (model != nullptr)
294  models.insert(model);
295  }
296  }
297  FOR_EACH (std::set<SkillModel*>::iterator, it, models)
298  {
299  SkillModel *const model = *it;
300  if (model != nullptr)
301  model->updateVisibilities();
302  }
303 }
304 
306 {
307  std::set<SkillModel*> models;
308 
309  FOR_EACH (SkillMap::const_iterator, it, mSkills)
310  {
311  SkillInfo *const info = (*it).second;
312  if (info != nullptr)
313  {
314  if (info->visible == Visible_false)
315  {
316  SkillModel *const model = info->model;
317  if (model != nullptr)
318  models.insert(model);
319  }
320  }
321  }
322  FOR_EACH (std::set<SkillModel*>::iterator, it, models)
323  {
324  SkillModel *const model = *it;
325  if (model != nullptr)
326  model->updateVisibilities();
327  }
328 }
329 
331 {
332  mTabs->removeAll(true);
333  mDeleteTabs.clear();
334  mDefaultTab = nullptr;
335  mDefaultModel = nullptr;
336 
338  mSkills.clear();
339  mDurations.clear();
340 }
341 
343 {
344  FOR_EACH (SkillMap::iterator, it, mSkills)
345  {
346  SkillInfo *const info = (*it).second;
347  if ((info != nullptr) && info->owner == owner)
348  {
349  PlayerInfo::setSkillLevel(info->id, 0);
350  if (info->alwaysVisible == Visible_false)
351  info->visible = Visible_false;
352  }
353  }
354 }
355 
357 {
358  clearSkills();
360  if (mSkills.empty())
362  loadXmlFile(paths.getStringValue("skillsPatchFile"), SkipError_true);
363  loadXmlDir("skillsPatchDir", loadXmlFile);
364  addDefaultTab();
365 
366  update();
367 }
368 
369 void SkillDialog::loadXmlFile(const std::string &fileName,
370  const SkipError skipError)
371 {
372  XML::Document doc(fileName,
374  skipError);
375  XmlNodePtrConst root = doc.rootNode();
376 
377  int setCount = 0;
378 
379  if ((root == nullptr) || !xmlNameEqual(root, "skills"))
380  {
381  logger->log("Error loading skills: " + fileName);
382  return;
383  }
384 
385  for_each_xml_child_node(set, root)
386  {
387  if (xmlNameEqual(set, "include"))
388  {
389  const std::string name = XML::getProperty(set, "name", "");
390  if (!name.empty())
391  loadXmlFile(name, skipError);
392  continue;
393  }
394  else if (xmlNameEqual(set, "set"))
395  {
396  setCount++;
397  const std::string setName = XML::getProperty(set, "name",
398  // TRANSLATORS: skills dialog default skill tab
399  strprintf(_("Skill Set %d"), setCount));
400 
401  const std::string setTypeStr = XML::getProperty(set, "type", "");
403  if (setTypeStr.empty() ||
404  setTypeStr == "list" ||
405  setTypeStr == "vertical")
406  {
407  setType = SkillSetType::VerticalList;
408  }
409  else if (setTypeStr == "rectangle")
410  {
411  setType = SkillSetType::Rectangle;
412  }
413 
414  bool alwaysVisible = false;
415  SkillModel *const model = new SkillModel;
416  SkillTab *tab = nullptr;
417  ScrollArea *scroll = nullptr;
418 
419  switch (setType)
420  {
422  {
423  // possible leak listbox, scroll
424  SkillListBox *const listbox = new SkillListBox(this,
425  model);
426  listbox->setActionEventId("sel");
427  listbox->addActionListener(this);
428  scroll = new ScrollArea(this,
429  listbox,
430  Opaque_false,
431  std::string());
434  tab = new SkillTab(this, setName, listbox);
435  break;
436  }
438  {
439  SkillRectangleListBox *const listbox =
440  new SkillRectangleListBox(this,
441  model);
442  listbox->setActionEventId("sel");
443  listbox->addActionListener(this);
444  scroll = new ScrollArea(this,
445  listbox,
446  Opaque_false,
447  std::string());
450  tab = new SkillTab(this, setName, listbox);
451  break;
452  }
453  default:
454  reportAlways("Unsupported skillset type: %s",
455  setTypeStr.c_str());
456  return;
457  }
458  if (mDefaultModel == nullptr)
459  {
461  mDefaultTab = tab;
462  }
463 
464  mDeleteTabs.push_back(tab);
465  if (alwaysVisible == true)
466  tab->setVisible(Visible_true);
467  else
469  mTabs->addTab(tab, scroll);
470 
471  for_each_xml_child_node(node, set)
472  {
473  if (xmlNameEqual(node, "skill"))
474  {
475  SkillInfo *const skill = loadSkill(node, model);
476  if (skill == nullptr)
477  continue;
478  if (skill->alwaysVisible == Visible_true)
479  alwaysVisible = true;
480  skill->tab = tab;
481  for_each_xml_child_node(levelNode, node)
482  {
483  if (!xmlNameEqual(levelNode, "level"))
484  continue;
485  loadSkillData(node, skill);
486  }
487  }
488  }
489 
490  model->updateVisibilities();
491  }
492  }
493 }
494 
495 SkillInfo *SkillDialog::loadSkill(XmlNodeConstPtr node,
496  SkillModel *const model)
497 {
498  int id = XML::getIntProperty(node, "id", -1, -1, 1000000);
499  if (id == -1)
500  {
501  id = XML::getIntProperty(node, "var", -1, -1, 100000);
502  if (id == -1)
503  return nullptr;
504  id += SKILL_VAR_MIN_ID;
505  }
506 
507  SkillInfo *skill = getSkill(id);
508  if (skill == nullptr)
509  {
510  std::string name = XML::langProperty(node, "name",
511  // TRANSLATORS: skills dialog. skill id
512  strprintf(_("Skill %d"), id));
513 
514  skill = new SkillInfo;
515  skill->id = CAST_U32(id);
516  skill->modifiable = Modifiable_false;
517  skill->model = model;
518  skill->update();
519  skill->useButton = XML::getProperty(
520  // TRANSLATORS: skills dialog button
521  node, "useButton", _("Use"));
523  node, "owner", "player"));
524  skill->errorText = XML::getProperty(
525  node, "errorText", name);
527  node, "alwaysVisible", false), Visible);
528  skill->castingAction = XML::getProperty(node,
529  "castingAction", SpriteAction::CAST);
530  skill->castingRideAction = XML::getProperty(node,
531  "castingRideAction", SpriteAction::CASTRIDE);
532  skill->castingSkyAction = XML::getProperty(node,
533  "castingSkyAction", SpriteAction::CASTSKY);
534  skill->castingWaterAction = XML::getProperty(node,
535  "castingWaterAction", SpriteAction::CASTWATER);
537  node, "useTextParameter", false);
538  skill->x = XML::getProperty(node,
539  "x", 0);
540  skill->y = XML::getProperty(node,
541  "y", 0);
542  skill->visible = skill->alwaysVisible;
543  model->addSkill(skill);
544  mSkills[id] = skill;
545  }
546 
547  loadSkillData(node, skill);
548  return skill;
549 }
550 
551 void SkillDialog::loadSkillData(XmlNodeConstPtr node,
552  SkillInfo *const skill)
553 {
554  if (skill == nullptr)
555  return;
556  const int level = (skill->alwaysVisible == Visible_true) ?
557  0 : XML::getProperty(node, "level", 0);
558  SkillData *data = skill->getData(level);
559  if (data == nullptr)
560  data = new SkillData;
561 
562  const std::string name = XML::langProperty(node, "name",
563  // TRANSLATORS: skills dialog. skill id
564  strprintf(_("Skill %u"), skill->id));
565  data->name = name;
566  const std::string icon = XML::getProperty(node, "icon", "");
567  if (icon.empty())
568  {
569  data->setIcon(paths.getStringValue("missingSkillIcon"));
570  data->haveIcon = false;
571  }
572  else
573  {
574  data->setIcon(icon);
575  data->haveIcon = true;
576  }
577  if (skill->id < SKILL_VAR_MIN_ID)
578  {
579  data->dispName = strprintf("%s, %u",
580  name.c_str(),
581  skill->id);
582  }
583  else
584  {
585  data->dispName = strprintf("%s, (%u)",
586  name.c_str(),
587  skill->id - SKILL_VAR_MIN_ID);
588  }
589  data->shortName = XML::langProperty(node,
590  "shortName", name.substr(0, 3));
592  node, "description", "");
593 
594  MissileInfo &missile = data->missile;
595  missile.particle = XML::getProperty(
596  node, "missile-particle", "");
597  missile.z = XML::getFloatProperty(
598  node, "missile-z", 32.0f);
599  missile.lifeTime = XML::getProperty(
600  node, "missile-lifetime", 500);
601  missile.speed = XML::getFloatProperty(
602  node, "missile-speed", 7.0f);
604  node, "missile-diedistance", 8.0f);
605 
606  MissileInfo &castingMissile = data->castingMissile;
607  castingMissile.particle = XML::getProperty(
608  node, "castingMissile-particle", "");
609  castingMissile.z = XML::getFloatProperty(
610  node, "castingMissile-z", 32.0f);
611  castingMissile.lifeTime = XML::getProperty(
612  node, "castingMissile-lifetime", 500);
613  castingMissile.speed = XML::getFloatProperty(
614  node, "castingMissile-speed", 7.0f);
615  castingMissile.dieDistance = XML::getFloatProperty(
616  node, "castingMissile-diedistance", 8.0f);
617 
619  node,
620  "castingAnimation",
621  paths.getStringValue("skillCastingAnimation"));
622 
624  node, "soundHit", "");
626  node, "soundHitDelay", 0);
628  node, "soundMiss", "");
630  node, "soundMissDelay", 0);
631  data->invokeCmd = XML::getProperty(
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);
653 
654  skill->addData(level, data);
655 }
656 
657 void SkillDialog::removeSkill(const int id)
658 {
659  const SkillMap::const_iterator it = mSkills.find(id);
660 
661  if (it != mSkills.end())
662  {
663  SkillInfo *const info = it->second;
664  if (info != nullptr)
665  {
666  info->level = 0;
667  info->update();
669  if (info->alwaysVisible == Visible_false)
670  info->visible = Visible_false;
671  }
672  }
673 }
674 
675 bool SkillDialog::updateSkill(const int id,
676  const int range,
677  const Modifiable modifiable,
678  const SkillType::SkillType type,
679  const int sp)
680 {
681  const SkillMap::const_iterator it = mSkills.find(id);
682 
683  if (it != mSkills.end())
684  {
685  SkillInfo *const info = it->second;
686  if (info != nullptr)
687  {
688  info->modifiable = modifiable;
689  info->range = range;
690  info->type = type;
691  info->sp = sp;
692  info->update();
693  if (info->tab != nullptr)
694  {
695  info->tab->setVisible(Visible_true);
698  }
699  }
700  return true;
701  }
702  return false;
703 }
704 
706 {
707  std::string icon;
708  switch (type)
709  {
710  case SkillType::Attack:
711  icon = paths.getStringValue("attackSkillIcon");
712  break;
713  case SkillType::Ground:
714  icon = paths.getStringValue("groundSkillIcon");
715  break;
716  case SkillType::Self:
717  icon = paths.getStringValue("selfSkillIcon");
718  break;
719  case SkillType::Unused:
720  icon = paths.getStringValue("unusedSkillIcon");
721  break;
722  case SkillType::Support:
723  icon = paths.getStringValue("supportSkillIcon");
724  break;
726  icon = paths.getStringValue("trapSkillIcon");
727  break;
728  case SkillType::Unknown:
729  icon = paths.getStringValue("unknownSkillIcon");
730  break;
731  default:
732  break;
733  }
734  return icon;
735 }
736 
738  const int id,
739  const std::string &name,
740  const int level,
741  const int range,
742  const Modifiable modifiable,
743  const SkillType::SkillType type,
744  const int sp)
745 {
746  if (mDefaultModel != nullptr)
747  {
748  SkillInfo *const skill = new SkillInfo;
749  skill->id = CAST_U32(id);
750  skill->type = type;
751  skill->owner = owner;
752  SkillData *const data = skill->data;
753  if (name.empty())
754  {
755  data->name = "Unknown skill Id: " + toString(id);
756  data->dispName = data->name;
757  }
758  else
759  {
760  data->name = name;
761  data->dispName = strprintf("%s, %u", name.c_str(), skill->id);
762  }
763  data->description.clear();
764  const std::string icon = getDefaultSkillIcon(type);
765  if (icon.empty())
766  {
767  data->setIcon(paths.getStringValue("missingSkillIcon"));
768  data->haveIcon = false;
769  }
770  else
771  {
772  data->setIcon(icon);
773  data->haveIcon = true;
774  }
776  data->shortName = toString(skill->id);
777  skill->modifiable = modifiable;
778  skill->visible = Visible_false;
779  skill->alwaysVisible = Visible_false;
780  skill->model = mDefaultModel;
781  skill->level = level;
782  // TRANSLATORS: skills dialog. skill level
783  skill->skillLevel = strprintf(_("Lvl: %d"), level);
784  skill->range = range;
785  skill->sp = sp;
786  skill->update();
787  // TRANSLATORS: skills dialog button
788  skill->useButton = _("Use");
789  // TRANSLATORS: skill error message
790  skill->errorText = strprintf(_("Failed skill: %s"), name.c_str());
791  skill->tab = mDefaultTab;
792  mDefaultModel->addSkill(skill);
796 
797  mSkills[id] = skill;
799  }
800 }
801 
802 SkillInfo* SkillDialog::getSkill(const int id) const
803 {
804  SkillMap::const_iterator it = mSkills.find(id);
805  if (it != mSkills.end())
806  return (*it).second;
807  return nullptr;
808 }
809 
810 SkillInfo* SkillDialog::getSkillByItem(const int itemId) const
811 {
812  SkillMap::const_iterator it = mSkills.find(itemId - SKILL_MIN_ID);
813  if (it != mSkills.end())
814  return (*it).second;
815  return nullptr;
816 }
817 
819  const int id,
820  const int duration)
821 {
822  SkillMap::const_iterator it = mSkills.find(id);
823  SkillInfo *info = nullptr;
824  if (it == mSkills.end())
825  {
826  addSkill(owner, id, "", 0, 0, Modifiable_false, SkillType::Unknown, 0);
827  it = mSkills.find(id);
828  }
829  if (it != mSkills.end())
830  {
831  info = (*it).second;
832  }
833  if (info != nullptr)
834  {
835  info->duration = duration;
836  info->durationTime = tick_time;
837  addSkillDuration(info);
838  }
839 }
840 
842 {
843  Window::widgetResized(event);
844 
845  if (mTabs != nullptr)
846  mTabs->adjustSize();
847 }
848 
849 void SkillDialog::useItem(const int itemId,
850  const AutoTarget autoTarget,
851  const int level,
852  const std::string &data) const
853 {
854  const std::map<int, SkillInfo*>::const_iterator
855  it = mSkills.find(itemId - SKILL_MIN_ID);
856  if (it == mSkills.end())
857  return;
858 
859  const SkillInfo *const info = (*it).second;
860  CastTypeT castType = CastType::Default;
861  int offsetX = 0;
862  int offsetY = 0;
863 
864  if (!data.empty())
865  {
866  STD_VECTOR<int> vect;
867  splitToIntVector(vect, data, ' ');
868  const size_t sz = vect.size();
869  if (sz > 0)
870  castType = static_cast<CastTypeT>(vect[0]);
871  if (sz > 2)
872  {
873  offsetX = vect[1];
874  offsetY = vect[2];
875  }
876  }
877  useSkill(info,
878  autoTarget,
879  level,
880  false,
881  std::string(),
882  castType,
883  offsetX,
884  offsetY);
885 }
886 
888 {
889  const SkillTab *const tab = static_cast<SkillTab*>(
890  mTabs->getSelectedTab());
891  if (tab != nullptr)
892  {
893  if (const SkillInfo *const info = tab->getSelectedInfo())
894  {
895  mUseButton->setEnabled(info->range > 0);
897  mUseButton->setCaption(info->useButton);
898  }
899  else
900  {
901  mUseButton->setEnabled(false);
902  // TRANSLATORS: inventory button
903  mUseButton->setCaption(_("Use"));
904  }
905  }
906 }
907 
908 void SkillDialog::updateQuest(const int var,
909  const int val1,
910  const int val2 A_UNUSED,
911  const int val3 A_UNUSED,
912  const int time1 A_UNUSED)
913 {
914  const int id = var + SKILL_VAR_MIN_ID;
915  const SkillMap::const_iterator it = mSkills.find(id);
916 
917  if (it != mSkills.end())
918  {
919  SkillInfo *const info = it->second;
920  if (info != nullptr)
921  {
922  PlayerInfo::setSkillLevel(id, val1);
923  info->level = val1;
924  info->update();
925  }
926  }
927 }
928 
930 {
931  const SkillMap::const_iterator it = mSkills.find(id);
932  if (it != mSkills.end())
933  {
934  SkillInfo *const info = it->second;
935  if (info != nullptr)
936  return info->data;
937  }
938  return nullptr;
939 }
940 
942  const int level) const
943 {
944  const SkillMap::const_iterator it = mSkills.find(id);
945  if (it != mSkills.end())
946  {
947  SkillInfo *const info = it->second;
948  if (info != nullptr)
949  return info->getData1(level);
950  }
951  return nullptr;
952 }
953 
954 void SkillDialog::playUpdateEffect(const int id) const
955 {
956  if (effectManager == nullptr)
957  return;
958  const SkillData *const data = getSkillData(id);
959  if (data == nullptr)
960  return;
962  localPlayer,
963  paths.getIntValue("skillLevelUpEffectId"));
964 }
965 
966 void SkillDialog::playRemoveEffect(const int id) const
967 {
968  if (effectManager == nullptr)
969  return;
970  const SkillData *const data = getSkillData(id);
971  if (data == nullptr)
972  return;
974  localPlayer,
975  paths.getIntValue("skillRemoveEffectId"));
976 }
977 
979  const int level,
980  const int x,
981  const int y,
982  const int delay) const
983 {
984  if (effectManager == nullptr)
985  return;
986  SkillData *const data = getSkillDataByLevel(id, level);
987  if (data == nullptr)
988  return;
990  x * 32,
991  y * 32,
992  cur_time + delay / 1000, // end time in seconds
993  paths.getIntValue("skillCastingGroundEffectId"));
994 }
995 
996 void SkillDialog::useSkill(const int skillId,
997  const AutoTarget autoTarget,
998  int level,
999  const bool withText,
1000  const std::string &text,
1001  CastTypeT castType,
1002  const int offsetX,
1003  const int offsetY)
1004 {
1005  SkillInfo *const info = skillDialog->getSkill(skillId);
1006  if (info == nullptr)
1007  return;
1008  if (castType == CastType::Default)
1009  castType = info->customCastType;
1010  useSkill(info,
1011  autoTarget,
1012  level,
1013  withText,
1014  text,
1015  castType,
1016  offsetX,
1017  offsetY);
1018 }
1019 
1021  const AutoTarget autoTarget,
1022  int level,
1023  const bool withText,
1024  const std::string &text,
1025  const CastTypeT castType,
1026  const int offsetX,
1027  const int offsetY)
1028 {
1029  if ((info == nullptr) || (localPlayer == nullptr))
1030  return;
1031  if (level == 0)
1032  level = info->level;
1033 
1034  const SkillData *data = info->getData1(level);
1035  if (data != nullptr)
1036  {
1037  const std::string cmd = data->invokeCmd;
1038  if (!cmd.empty())
1040  }
1041  switch (castType)
1042  {
1043  default:
1044  case CastType::Default:
1045  useSkillDefault(info,
1046  autoTarget,
1047  level,
1048  withText,
1049  text,
1050  offsetX,
1051  offsetY);
1052  break;
1053  case CastType::Target:
1054  {
1055  const Being *const being = localPlayer->getTarget();
1056  useSkillTarget(info,
1057  autoTarget,
1058  level,
1059  withText,
1060  text,
1061  being,
1062  offsetX,
1063  offsetY);
1064  break;
1065  }
1066  case CastType::Position:
1067  {
1068  int x = 0;
1069  int y = 0;
1070  viewport->getMouseTile(x, y);
1071  useSkillPosition(info,
1072  level,
1073  withText,
1074  text,
1075  x,
1076  y,
1077  offsetX,
1078  offsetY);
1079  break;
1080  }
1081  case CastType::Self:
1082  // +++ probably need call useSkillSelf
1083  useSkillTarget(info,
1084  autoTarget,
1085  level,
1086  withText,
1087  text,
1088  localPlayer,
1089  offsetX,
1090  offsetY);
1091  break;
1092  }
1093 }
1094 
1096  const AutoTarget autoTarget,
1097  int level,
1098  const bool withText,
1099  const std::string &text,
1100  const Being *being,
1101  int offsetX,
1102  int offsetY)
1103 {
1104  SkillType::SkillType type = info->type;
1105  if ((type & SkillType::Attack) != 0)
1106  {
1107  if ((being == nullptr) && autoTarget == AutoTarget_true)
1108  {
1109  if (localPlayer != nullptr)
1110  {
1112  AllowSort_true);
1113  }
1114  }
1115  if (being != nullptr)
1116  {
1117  skillHandler->useBeing(info->id,
1118  level,
1119  being->getId());
1120  }
1121  }
1122  else if ((type & SkillType::Support) != 0)
1123  {
1124  if (being == nullptr)
1125  being = localPlayer;
1126  if (being != nullptr)
1127  {
1128  skillHandler->useBeing(info->id,
1129  level,
1130  being->getId());
1131  }
1132  }
1133  else if ((type & SkillType::Self) != 0)
1134  {
1135  skillHandler->useBeing(info->id,
1136  level,
1137  localPlayer->getId());
1138  }
1139  else if ((type & SkillType::Ground) != 0)
1140  {
1141  if (being == nullptr)
1142  return;
1143  being->fixDirectionOffsets(offsetX, offsetY);
1144  const int x = being->getTileX() + offsetX;
1145  const int y = being->getTileY() + offsetY;
1146  if (info->useTextParameter)
1147  {
1148  if (withText)
1149  {
1150  skillHandler->usePos(info->id,
1151  level,
1152  x, y,
1153  text);
1154  }
1155  else
1156  {
1157  const SkillData *data = info->getData1(level);
1159  x,
1160  y,
1161  level);
1162  TextDialog *const dialog = CREATEWIDGETR(TextDialog,
1163  // TRANSLATORS: text skill dialog header
1164  strprintf(_("Add text to skill %s"),
1165  data->name.c_str()),
1166  // TRANSLATORS: text skill dialog field
1167  _("Text: "),
1168  nullptr,
1169  false);
1170  dialog->setModal(Modal_true);
1171  textSkillListener.setDialog(dialog);
1172  dialog->setActionEventId("ok");
1174  }
1175  }
1176  else
1177  {
1178  skillHandler->usePos(info->id,
1179  level,
1180  x, y);
1181  }
1182  }
1183  else if ((type & SkillType::TargetTrap) != 0)
1184  {
1185  // for now unused
1186  }
1187  else if (type == SkillType::Unknown ||
1188  type == SkillType::Unused)
1189  {
1190  // unknown / unused
1191  }
1192  else
1193  {
1194  reportAlways("Unsupported skill type: %d", type);
1195  }
1196 }
1197 
1199  int level,
1200  const bool withText,
1201  const std::string &text,
1202  const int x,
1203  const int y,
1204  int offsetX,
1205  int offsetY)
1206 {
1207  SkillType::SkillType type = info->type;
1208  if ((type & SkillType::Ground) != 0)
1209  {
1210  localPlayer->fixDirectionOffsets(offsetX, offsetY);
1211  if (info->useTextParameter)
1212  {
1213  if (withText)
1214  {
1215  skillHandler->usePos(info->id,
1216  level,
1217  x + offsetX,
1218  y + offsetY,
1219  text);
1220  }
1221  else
1222  {
1223  const SkillData *data = info->getData1(level);
1225  x + offsetX,
1226  y + offsetY,
1227  level);
1228  TextDialog *const dialog = CREATEWIDGETR(TextDialog,
1229  // TRANSLATORS: text skill dialog header
1230  strprintf(_("Add text to skill %s"),
1231  data->name.c_str()),
1232  // TRANSLATORS: text skill dialog field
1233  _("Text: "),
1234  nullptr,
1235  false);
1236  dialog->setModal(Modal_true);
1237  textSkillListener.setDialog(dialog);
1238  dialog->setActionEventId("ok");
1240  }
1241  }
1242  else
1243  {
1244  skillHandler->usePos(info->id,
1245  level,
1246  x + offsetX,
1247  y + offsetY);
1248  }
1249  }
1250  else if ((type & SkillType::Support) != 0)
1251  {
1252  // wrong type
1253  skillHandler->useBeing(info->id,
1254  level,
1255  localPlayer->getId());
1256  }
1257  else if ((type & SkillType::Self) != 0)
1258  {
1259  skillHandler->useBeing(info->id,
1260  level,
1261  localPlayer->getId());
1262  }
1263  else if ((type & SkillType::Attack) != 0)
1264  {
1265  // do nothing
1266  // +++ probably need select some target on x,y position?
1267  }
1268  else if ((type & SkillType::TargetTrap) != 0)
1269  {
1270  // for now unused
1271  }
1272  else if (type == SkillType::Unknown ||
1273  type == SkillType::Unused)
1274  {
1275  // unknown / unused
1276  }
1277  else
1278  {
1279  reportAlways("Unsupported skill type: %d", type);
1280  }
1281 }
1282 
1284  const AutoTarget autoTarget,
1285  int level,
1286  const bool withText,
1287  const std::string &text,
1288  int offsetX,
1289  int offsetY)
1290 {
1291  SkillType::SkillType type = info->type;
1292  if ((type & SkillType::Attack) != 0)
1293  {
1294  const Being *being = localPlayer->getTarget();
1295  if ((being == nullptr) && autoTarget == AutoTarget_true)
1296  {
1298  AllowSort_true);
1299  }
1300  if (being != nullptr)
1301  {
1302  skillHandler->useBeing(info->id,
1303  level,
1304  being->getId());
1305  }
1306  }
1307  else if ((type & SkillType::Support) != 0)
1308  {
1309  const Being *being = localPlayer->getTarget();
1310  if (being == nullptr)
1311  being = localPlayer;
1312  if (being != nullptr)
1313  {
1314  skillHandler->useBeing(info->id,
1315  level,
1316  being->getId());
1317  }
1318  }
1319  else if ((type & SkillType::Self) != 0)
1320  {
1321  skillHandler->useBeing(info->id,
1322  level,
1323  localPlayer->getId());
1324  }
1325  else if ((type & SkillType::Ground) != 0)
1326  {
1327  int x = 0;
1328  int y = 0;
1329  viewport->getMouseTile(x, y);
1330  localPlayer->fixDirectionOffsets(offsetX, offsetY);
1331  x += offsetX;
1332  y += offsetY;
1333  if (info->useTextParameter)
1334  {
1335  if (withText)
1336  {
1337  skillHandler->usePos(info->id,
1338  level,
1339  x, y,
1340  text);
1341  }
1342  else
1343  {
1344  const SkillData *data = info->getData1(level);
1346  x,
1347  y,
1348  level);
1349  TextDialog *const dialog = CREATEWIDGETR(TextDialog,
1350  // TRANSLATORS: text skill dialog header
1351  strprintf(_("Add text to skill %s"),
1352  data->name.c_str()),
1353  // TRANSLATORS: text skill dialog field
1354  _("Text: "),
1355  nullptr,
1356  false);
1357  dialog->setModal(Modal_true);
1358  textSkillListener.setDialog(dialog);
1359  dialog->setActionEventId("ok");
1361  }
1362  }
1363  else
1364  {
1365  skillHandler->usePos(info->id,
1366  level,
1367  x, y);
1368  }
1369  }
1370  else if ((type & SkillType::TargetTrap) != 0)
1371  {
1372  // for now unused
1373  }
1374  else if (type == SkillType::Unknown ||
1375  type == SkillType::Unused)
1376  {
1377  // unknown / unused
1378  }
1379  else
1380  {
1381  reportAlways("Unsupported skill type: %d", type);
1382  }
1383 }
1384 
1386 {
1387  if (skill == nullptr)
1388  return;
1389 
1390  FOR_EACH (STD_VECTOR<SkillInfo*>::const_iterator, it, mDurations)
1391  {
1392  if ((*it)->id == skill->id)
1393  return;
1394  }
1395  mDurations.push_back(skill);
1396 }
1397 
1399 {
1400  FOR_EACH_SAFE (STD_VECTOR<SkillInfo*>::iterator, it, mDurations)
1401  {
1402  SkillInfo *const skill = *it;
1403  if (skill != nullptr)
1404  {
1405  const int time = get_elapsed_time(skill->durationTime);
1406  if (time >= skill->duration)
1407  {
1408  it = mDurations.erase(it);
1409  skill->cooldown = 0;
1410  skill->duration = 0;
1411  skill->durationTime = 0;
1412  if (it == mDurations.end())
1413  return;
1414  if (it != mDurations.begin())
1415  -- it;
1416  }
1417  else if (time != 0)
1418  {
1419  skill->cooldown = skill->duration * 100 / time;
1420  }
1421  }
1422  }
1423 }
1424 
1425 void SkillDialog::selectSkillLevel(const int skillId,
1426  const int level)
1427 {
1428  SkillInfo *const info = getSkill(skillId);
1429  if (info == nullptr)
1430  return;
1431  if (level > info->level)
1432  info->customSelectedLevel = info->level;
1433  else
1434  info->customSelectedLevel = level;
1435  info->update();
1436 }
1437 
1438 void SkillDialog::selectSkillCastType(const int skillId,
1439  const CastTypeT type)
1440 {
1441  SkillInfo *const info = getSkill(skillId);
1442  if (info == nullptr)
1443  return;
1444  info->customCastType = type;
1445  info->update();
1446 }
1447 
1448 void SkillDialog::setSkillOffsetX(const int skillId,
1449  const int offset)
1450 {
1451  SkillInfo *const info = getSkill(skillId);
1452  if (info == nullptr)
1453  return;
1454  info->customOffsetX = offset;
1455  info->update();
1456 }
1457 
1458 void SkillDialog::setSkillOffsetY(const int skillId,
1459  const int offset)
1460 {
1461  SkillInfo *const info = getSkill(skillId);
1462  if (info == nullptr)
1463  return;
1464  info->customOffsetY = offset;
1465  info->update();
1466 }
Net::PlayerHandler * playerHandler
Definition: net.cpp:92
const bool AutoTarget_true
Definition: autotarget.h:29
void adjustTabPositions()
Definition: tabbedarea.cpp:604
#define CAST_U32
Definition: cast.h:30
unsigned int id
Definition: skillinfo.h:68
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
void setDefaultSize()
Definition: window.cpp:1193
LayoutCell & place(const int x, const int y, Widget *const wg, const int w, const int h)
Definition: window.cpp:1379
std::string getStringValue(const std::string &key) const
#define _(s)
Definition: gettext.h:34
int castingGroundEffectId
Definition: skilldata.h:54
const bool SkipError_false
Definition: skiperror.h:29
void removeAll(const bool del)
Definition: tabbedarea.cpp:727
int getWidth() const
Definition: widget.h:220
void addSkill(SkillInfo *const info)
Definition: skillmodel.h:48
void setItemSelected(const int itemId)
Definition: itemshortcut.h:125
Being * setNewTarget(const ActorTypeT type, const AllowSort allowSort)
const bool Modifiable_true
Definition: modifiable.h:29
int getTileY() const
Definition: being.h:173
bool skill(InputEvent &event)
Definition: commands.cpp:96
void useItem(const int itemId, const AutoTarget autoTarget, const int level, const std::string &data) const
void updateModels()
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)
Definition: libxml.cpp:210
std::string useButton
Definition: skillinfo.h:53
std::string sound
Definition: soundinfo.h:44
SkillInfo * getSkillByItem(const int itemId) const
volatile int tick_time
Definition: timer.cpp:52
static const std::string CASTRIDE("castride")
const bool Visible_true
Definition: visible.h:29
SkillSetType ::T SkillSetTypeT
Definition: skillsettype.h:31
int hitEffectId
Definition: skilldata.h:50
void updateTabSelection()
void loadWindowState()
Definition: window.cpp:1082
WindowContainer * windowContainer
void setSkillOffsetX(const int skillId, const int offset)
SkillData * getData(const int level) const
Definition: skillinfo.cpp:182
Label * mPointsLabel
Definition: skilldialog.h:230
bool useTextParameter
Definition: skillinfo.h:82
#define fromInt(val, name)
Definition: intdefines.h:45
std::string fileName
Definition: testmain.cpp:38
TabbedArea * mTabs
Definition: skilldialog.h:228
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:251
SkillPopup * skillPopup
Definition: skillpopup.cpp:41
void loadXmlFile(const std::string &fileName, const SkipError skipError)
void setVisible(Visible visible)
Definition: widget.cpp:224
SkillTab * mDefaultTab
Definition: skilldialog.h:234
BeingId getId() const
Definition: actorsprite.h:63
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)
Definition: skilldialog.cpp:72
SkillTab * tab
Definition: skillinfo.h:61
int cooldown
Definition: skillinfo.h:73
CastTypeT customCastType
Definition: skillinfo.h:78
Button * mIncreaseButton
Definition: skilldialog.h:232
void reset()
Definition: skillpopup.cpp:248
Definition: window.h:98
void removeSkill(const int id)
std::string name
Definition: skilldata.h:33
std::string description
Definition: skilldata.h:36
Definition: button.h:96
std::string castingWaterAction
Definition: skillinfo.h:58
Configuration config
int getProperty(const xmlNodePtr node, const char *const name, int def)
Definition: libxml.cpp:173
const unsigned int SKILL_VAR_MIN_ID
Definition: skill.h:25
const size_t SHORTCUT_AUTO_TAB
Definition: itemshortcut.h:28
SoundInfo soundHit
Definition: skilldata.h:43
uint16_t ItemColor
Definition: itemcolor.h:29
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 setActionEventId(const std::string &actionEventId)
Definition: widget.h:595
void updateVisibilities()
Definition: skillmodel.cpp:53
SkillInfo * getSelectedInfo() const
Definition: skilltab.h:66
const bool AllowSort_true
Definition: allowsort.h:29
std::string castingRideAction
Definition: skillinfo.h:56
void setSkill(const int skillId, const int x, const int y, const int level)
SkillOwner::Type owner
Definition: skillinfo.h:77
int customOffsetY
Definition: skillinfo.h:66
const int SKILL_MIN_ID
Definition: skill.h:24
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 setVerticalScrollPolicy(const ScrollPolicy vPolicy)
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)
Definition: itemshortcut.h:75
void hideSkills(const SkillOwner::Type owner)
void registerWindowForReset(Window *const window)
std::string errorText
Definition: skillinfo.h:54
#define loadXmlDir(name, function)
Definition: beingcommon.h:38
Logger * logger
Definition: logger.cpp:88
SkillData * data
Definition: skillinfo.h:62
std::string castingAnimation
Definition: skilldata.h:41
int get_elapsed_time(const int startTime)
Definition: timer.cpp:93
SkillData * getSkillDataByLevel(const int id, const int level) const
int srcEffectId
Definition: skilldata.h:55
void updateModelsHidden()
std::string toDataStr() const
Definition: skillinfo.cpp:198
void setSelectable(const bool selectable)
Definition: widget.h:947
#define new
Definition: debug_new.h:147
Settings settings
Definition: settings.cpp:31
int getIntProperty(const xmlNodePtr node, const char *const name, int def, const int min, const int max)
Definition: libxml.cpp:189
Widget * getWidgetContainer() const
Definition: tabbedarea.h:243
void widgetResized(const Event &event)
Definition: window.cpp:650
#define CAST_U16
Definition: cast.h:28
int castingSrcEffectId
Definition: skilldata.h:52
void triggerDefault(int effectId, Being *const being, const int defaultEffectId)
SkillInfo * getSkill(const int id) const
void setDialog(TextDialog *dialog)
const bool UseVirtFs_true
Definition: usevirtfs.h:29
bool getBoolValue(const std::string &key) const
void setCaption(const std::string &caption)
Definition: button.h:213
Net::SkillHandler * skillHandler
Definition: net.cpp:93
std::string castingAction
Definition: skillinfo.h:55
int duration
Definition: skillinfo.h:71
Modifiable modifiable
Definition: skillinfo.h:79
#define CAST_S32
Definition: cast.h:29
bool AutoTarget
Definition: autotarget.h:29
static const std::string CASTWATER("castwater")
Widget * getTabContainer() const
Definition: tabbedarea.h:240
const std::string BUTTON_SKIN
Definition: button.h:88
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
void delete_all(Container &c)
Definition: dtor.h:55
void setCaption(const std::string &caption)
Definition: label.cpp:261
int dstEffectId
Definition: skilldata.h:56
int getTabIndex() const
SkillInfo * loadSkill(const xmlNodePtr node, SkillModel *const model)
const bool Visible_false
Definition: visible.h:29
Definition: label.h:87
int removeEffectId
Definition: skilldata.h:49
#define fromBool(val, name)
Definition: booldefines.h:48
bool info(InputEvent &event)
Definition: commands.cpp:56
bool getBoolProperty(const xmlNodePtr node, const char *const name, const bool def)
Definition: libxml.cpp:268
static const std::string CAST("cast")
void selectSkillLevel(const int skillId, const int level)
uint32_t data
Button * mUseButton
Definition: skilldialog.h:231
void clearSkills()
LocalPlayer * localPlayer
void setSelectedTabDefault()
Definition: tabbedarea.cpp:431
bool unknownSkillsAutoTab
Definition: settings.h:161
SoundInfo soundMiss
Definition: skilldata.h:44
SkillModel * mDefaultModel
Definition: skilldialog.h:233
std::list< Tab * > mDeleteTabs
Definition: skilldialog.h:229
#define nullptr
Definition: localconsts.h:44
int customOffsetX
Definition: skillinfo.h:65
int level
Definition: skillinfo.h:63
static const std::string CASTSKY("castsky")
int range
Definition: skillinfo.h:69
MissileInfo castingMissile
Definition: skilldata.h:39
const bool Opaque_false
Definition: opaque.h:29
ShortcutWindow * itemShortcutWindow
void setIcon(const std::string &iconPath)
Definition: skilldata.cpp:70
const unsigned int SHORTCUT_TABS
Definition: itemshortcut.h:27
void setCloseButton(const bool flag)
Definition: window.cpp:744
void setSkillOffsetY(const int skillId, const int offset)
int sp
Definition: skillinfo.h:70
void playUpdateEffect(const int id) const
volatile time_t cur_time
Definition: timer.cpp:57
std::string particle
Definition: missileinfo.h:40
int customSelectedLevel
Definition: skillinfo.h:64
void widgetResized(const Event &event)
const bool Modifiable_false
Definition: modifiable.h:29
Visible alwaysVisible
Definition: skillinfo.h:81
ItemShortcut * itemShortcut[SHORTCUT_TABS]
void setSkillLevel(const int id, const int value)
Definition: playerinfo.cpp:126
void enableVisibleSound(bool b)
Definition: window.h:480
std::string castingSkyAction
Definition: skillinfo.h:57
void getMouseTile(int &destX, int &destY) const
Definition: viewport.cpp:613
void setEnabled(const bool enabled)
Definition: widget.h:351
xmlNodePtr rootNode()
Definition: libxml.cpp:168
void action(const ActionEvent &event)
void addSkillDuration(SkillInfo *const skill)
void fixDirectionOffsets(int &offsetX, int &offsetY) const
Definition: being.cpp:5528
std::string skillLevel
Definition: skillinfo.h:51
void selectSkillCastType(const int skillId, const CastTypeT type)
#define FOR_EACH_SAFE(type, iter, array)
Definition: foreach.h:33
virtual void useBeing(const int id, const int level, const BeingId beingId) const =0
bool haveIcon
Definition: skilldata.h:57
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)
Definition: skillinfo.cpp:177
void setSaveVisible(const bool save)
Definition: window.h:299
SkillData * getData1(const int level) const
Definition: skillinfo.cpp:190
Configuration paths
void update()
Definition: skillinfo.cpp:82
Widget * getParent() const
Definition: widget.h:201
void setItemFast(const size_t index, const int item, const ItemColor color)
SkillDialog * skillDialog
Definition: skilldialog.cpp:65
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
std::string langProperty(const xmlNodePtr node, const char *const name, const std::string &def)
Definition: libxml.cpp:257
int missEffectId
Definition: skilldata.h:51
#define A_UNUSED
Definition: localconsts.h:151
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)
Definition: window.cpp:773
void adjustSize()
Definition: tabbedarea.cpp:567
void addDefaultTab()
int updateEffectId
Definition: skilldata.h:48
float dieDistance
Definition: missileinfo.h:43
std::string dispName
Definition: skilldata.h:35
#define for_each_xml_child_node(var, parent)
Definition: libxml.h:160
void loadSkills()
Definition: event.h:77
Tab * getSelectedTab() const
Definition: tabbedarea.h:174
std::string invokeCmd
Definition: skilldata.h:40
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)
Visible visible
Definition: skillinfo.h:80
void setResizable(const bool resize)
Definition: window.cpp:622
void setStickyButtonLock(const bool sticky)
Definition: window.cpp:767
int getTileX() const
Definition: being.h:167
SetupWindow * setupWindow
Definition: setupwindow.cpp:63
static void invokeCommand(const std::string &command, const Being *const target)
void splitToIntVector(std::vector< int > &tokens, const std::string &text, const char separator)
SkillMap mSkills
Definition: skilldialog.h:226
#define CREATEWIDGETR(type,...)
Definition: createwidget.h:35
void log(const char *const log_text,...)
Definition: logger.cpp:264
std::vector< SkillInfo * > mDurations
Definition: skilldialog.h:227
const bool SkipError_true
Definition: skiperror.h:29
void postInit()
SkillType::SkillType type
Definition: skillinfo.h:76
void slowLogic()
bool autoTab
Definition: skilldata.h:58
int32_t getAttribute(const AttributesT id)
Definition: playerinfo.cpp:100
std::string shortName
Definition: skilldata.h:34
void updateQuest(const int var, const int val1, const int val2, const int val3, const int time1)
SkillData * getSkillData(const int id) const
Definition: being.h:93
void playRemoveEffect(const int id) const
EffectManager * effectManager
#define reportAlways(...)
Definition: checkutils.h:252
void adjustSize()
Definition: label.cpp:197
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)
Definition: window.cpp:508
int durationTime
Definition: skillinfo.h:72
int delay
Definition: soundinfo.h:45
int castingDstEffectId
Definition: skilldata.h:53
void setModal(const Modal modal)
Definition: window.cpp:1064
MissileInfo missile
Definition: skilldata.h:38
void postInit()
Definition: window.cpp:248
const unsigned int SHORTCUT_ITEMS
Definition: itemshortcut.h:26
SkillModel * model
Definition: skillinfo.h:60
Viewport * viewport
Definition: viewport.cpp:35
Being * getTarget() const
void addTab(Tab *const tab, Widget *const widget)
Definition: tabbedarea.cpp:237
void setWindowName(const std::string &name)
Definition: window.h:354
float speed
Definition: missileinfo.h:42
CastType ::T CastTypeT
Definition: casttype.h:33
void setHorizontalScrollPolicy(const ScrollPolicy hPolicy)