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", this)),
94  // TRANSLATORS: skills dialog button
95  mIncreaseButton(new Button(this, _("Up"), "inc", 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  mTabs->removeAll(true);
308  mDeleteTabs.clear();
309  mDefaultTab = nullptr;
310  mDefaultModel = nullptr;
311 
313  mSkills.clear();
314  mDurations.clear();
315 }
316 
318 {
319  FOR_EACH (SkillMap::iterator, it, mSkills)
320  {
321  SkillInfo *const info = (*it).second;
322  if ((info != nullptr) && info->owner == owner)
323  {
324  PlayerInfo::setSkillLevel(info->id, 0);
325  if (info->alwaysVisible == Visible_false)
326  info->visible = Visible_false;
327  }
328  }
329 }
330 
332 {
333  clearSkills();
335  if (mSkills.empty())
337  loadXmlFile(paths.getStringValue("skillsPatchFile"), SkipError_true);
338  loadXmlDir("skillsPatchDir", loadXmlFile);
339  addDefaultTab();
340 
341  update();
342 }
343 
344 void SkillDialog::loadXmlFile(const std::string &fileName,
345  const SkipError skipError)
346 {
347  XML::Document doc(fileName,
349  skipError);
350  XmlNodePtrConst root = doc.rootNode();
351 
352  int setCount = 0;
353 
354  if ((root == nullptr) || !xmlNameEqual(root, "skills"))
355  {
356  logger->log("Error loading skills: " + fileName);
357  return;
358  }
359 
360  for_each_xml_child_node(set, root)
361  {
362  if (xmlNameEqual(set, "include"))
363  {
364  const std::string name = XML::getProperty(set, "name", "");
365  if (!name.empty())
366  loadXmlFile(name, skipError);
367  continue;
368  }
369  else if (xmlNameEqual(set, "set"))
370  {
371  setCount++;
372  const std::string setName = XML::getProperty(set, "name",
373  // TRANSLATORS: skills dialog default skill tab
374  strprintf(_("Skill Set %d"), setCount));
375 
376  const std::string setTypeStr = XML::getProperty(set, "type", "");
378  if (setTypeStr.empty() ||
379  setTypeStr == "list" ||
380  setTypeStr == "vertical")
381  {
382  setType = SkillSetType::VerticalList;
383  }
384  else if (setTypeStr == "rectangle")
385  {
386  setType = SkillSetType::Rectangle;
387  }
388 
389  bool alwaysVisible = false;
390  SkillModel *const model = new SkillModel;
391  SkillTab *tab = nullptr;
392  ScrollArea *scroll = nullptr;
393 
394  switch (setType)
395  {
397  {
398  // possible leak listbox, scroll
399  SkillListBox *const listbox = new SkillListBox(this,
400  model);
401  listbox->setActionEventId("sel");
402  listbox->addActionListener(this);
403  scroll = new ScrollArea(this,
404  listbox,
405  Opaque_false,
406  std::string());
409  tab = new SkillTab(this, setName, listbox);
410  break;
411  }
413  {
414  SkillRectangleListBox *const listbox =
415  new SkillRectangleListBox(this,
416  model);
417  listbox->setActionEventId("sel");
418  listbox->addActionListener(this);
419  scroll = new ScrollArea(this,
420  listbox,
421  Opaque_false,
422  std::string());
425  tab = new SkillTab(this, setName, listbox);
426  break;
427  }
428  default:
429  reportAlways("Unsupported skillset type: %s",
430  setTypeStr.c_str());
431  return;
432  }
433  if (mDefaultModel == nullptr)
434  {
436  mDefaultTab = tab;
437  }
438 
439  mDeleteTabs.push_back(tab);
440  if (alwaysVisible == true)
441  tab->setVisible(Visible_true);
442  else
444  mTabs->addTab(tab, scroll);
445 
446  for_each_xml_child_node(node, set)
447  {
448  if (xmlNameEqual(node, "skill"))
449  {
450  SkillInfo *const skill = loadSkill(node, model);
451  if (skill == nullptr)
452  continue;
453  if (skill->alwaysVisible == Visible_true)
454  alwaysVisible = true;
455  skill->tab = tab;
456  for_each_xml_child_node(levelNode, node)
457  {
458  if (!xmlNameEqual(levelNode, "level"))
459  continue;
460  loadSkillData(node, skill);
461  }
462  }
463  }
464 
465  model->updateVisibilities();
466  }
467  }
468 }
469 
470 SkillInfo *SkillDialog::loadSkill(XmlNodeConstPtr node,
471  SkillModel *const model)
472 {
473  int id = XML::getIntProperty(node, "id", -1, -1, 1000000);
474  if (id == -1)
475  {
476  id = XML::getIntProperty(node, "var", -1, -1, 100000);
477  if (id == -1)
478  return nullptr;
479  id += SKILL_VAR_MIN_ID;
480  }
481 
482  SkillInfo *skill = getSkill(id);
483  if (skill == nullptr)
484  {
485  std::string name = XML::langProperty(node, "name",
486  // TRANSLATORS: skills dialog. skill id
487  strprintf(_("Skill %d"), id));
488 
489  skill = new SkillInfo;
490  skill->id = CAST_U32(id);
491  skill->modifiable = Modifiable_false;
492  skill->model = model;
493  skill->update();
494  skill->useButton = XML::getProperty(
495  // TRANSLATORS: skills dialog button
496  node, "useButton", _("Use"));
498  node, "owner", "player"));
499  skill->errorText = XML::getProperty(
500  node, "errorText", name);
502  node, "alwaysVisible", false), Visible);
503  skill->castingAction = XML::getProperty(node,
504  "castingAction", SpriteAction::CAST);
505  skill->castingRideAction = XML::getProperty(node,
506  "castingRideAction", SpriteAction::CASTRIDE);
507  skill->castingSkyAction = XML::getProperty(node,
508  "castingSkyAction", SpriteAction::CASTSKY);
509  skill->castingWaterAction = XML::getProperty(node,
510  "castingWaterAction", SpriteAction::CASTWATER);
512  node, "useTextParameter", false);
513  skill->x = XML::getProperty(node,
514  "x", 0);
515  skill->y = XML::getProperty(node,
516  "y", 0);
517  skill->visible = skill->alwaysVisible;
518  model->addSkill(skill);
519  mSkills[id] = skill;
520  }
521 
522  loadSkillData(node, skill);
523  return skill;
524 }
525 
526 void SkillDialog::loadSkillData(XmlNodeConstPtr node,
527  SkillInfo *const skill)
528 {
529  if (skill == nullptr)
530  return;
531  const int level = (skill->alwaysVisible == Visible_true) ?
532  0 : XML::getProperty(node, "level", 0);
533  SkillData *data = skill->getData(level);
534  if (data == nullptr)
535  data = new SkillData;
536 
537  const std::string name = XML::langProperty(node, "name",
538  // TRANSLATORS: skills dialog. skill id
539  strprintf(_("Skill %u"), skill->id));
540  data->name = name;
541  const std::string icon = XML::getProperty(node, "icon", "");
542  if (icon.empty())
543  {
544  data->setIcon(paths.getStringValue("missingSkillIcon"));
545  data->haveIcon = false;
546  }
547  else
548  {
549  data->setIcon(icon);
550  data->haveIcon = true;
551  }
552  if (skill->id < SKILL_VAR_MIN_ID)
553  {
554  data->dispName = strprintf("%s, %u",
555  name.c_str(),
556  skill->id);
557  }
558  else
559  {
560  data->dispName = strprintf("%s, (%u)",
561  name.c_str(),
562  skill->id - SKILL_VAR_MIN_ID);
563  }
564  data->shortName = XML::langProperty(node,
565  "shortName", name.substr(0, 3));
567  node, "description", "");
568 
569  MissileInfo &missile = data->missile;
570  missile.particle = XML::getProperty(
571  node, "missile-particle", "");
572  missile.z = XML::getFloatProperty(
573  node, "missile-z", 32.0f);
574  missile.lifeTime = XML::getProperty(
575  node, "missile-lifetime", 500);
576  missile.speed = XML::getFloatProperty(
577  node, "missile-speed", 7.0f);
579  node, "missile-diedistance", 8.0f);
580 
581  MissileInfo &castingMissile = data->castingMissile;
582  castingMissile.particle = XML::getProperty(
583  node, "castingMissile-particle", "");
584  castingMissile.z = XML::getFloatProperty(
585  node, "castingMissile-z", 32.0f);
586  castingMissile.lifeTime = XML::getProperty(
587  node, "castingMissile-lifetime", 500);
588  castingMissile.speed = XML::getFloatProperty(
589  node, "castingMissile-speed", 7.0f);
590  castingMissile.dieDistance = XML::getFloatProperty(
591  node, "castingMissile-diedistance", 8.0f);
592 
594  node,
595  "castingAnimation",
596  paths.getStringValue("skillCastingAnimation"));
597 
599  node, "soundHit", "");
601  node, "soundHitDelay", 0);
603  node, "soundMiss", "");
605  node, "soundMissDelay", 0);
606  data->invokeCmd = XML::getProperty(
607  node, "invokeCmd", "");
609  node, "levelUpEffectId", -1);
611  node, "removeEffectId", -1);
613  node, "hitEffectId", -1);
615  node, "missEffectId", -1);
617  node, "castingSrcEffectId", -1);
619  node, "castingDstEffectId", -1);
621  node, "srcEffectId", -1);
623  node, "dstEffectId", -1);
625  node, "castingGroundEffectId", -1);
627  node, "autoTab", true);
628 
629  skill->addData(level, data);
630 }
631 
632 void SkillDialog::removeSkill(const int id)
633 {
634  const SkillMap::const_iterator it = mSkills.find(id);
635 
636  if (it != mSkills.end())
637  {
638  SkillInfo *const info = it->second;
639  if (info != nullptr)
640  {
641  info->level = 0;
642  info->update();
644  if (info->alwaysVisible == Visible_false)
645  info->visible = Visible_false;
646  }
647  }
648 }
649 
650 bool SkillDialog::updateSkill(const int id,
651  const int range,
652  const Modifiable modifiable,
653  const SkillType::SkillType type,
654  const int sp)
655 {
656  const SkillMap::const_iterator it = mSkills.find(id);
657 
658  if (it != mSkills.end())
659  {
660  SkillInfo *const info = it->second;
661  if (info != nullptr)
662  {
663  info->modifiable = modifiable;
664  info->range = range;
665  info->type = type;
666  info->sp = sp;
667  info->update();
668  if (info->tab != nullptr)
669  {
670  info->tab->setVisible(Visible_true);
673  }
674  }
675  return true;
676  }
677  return false;
678 }
679 
681 {
682  std::string icon;
683  switch (type)
684  {
685  case SkillType::Attack:
686  icon = paths.getStringValue("attackSkillIcon");
687  break;
688  case SkillType::Ground:
689  icon = paths.getStringValue("groundSkillIcon");
690  break;
691  case SkillType::Self:
692  icon = paths.getStringValue("selfSkillIcon");
693  break;
694  case SkillType::Unused:
695  icon = paths.getStringValue("unusedSkillIcon");
696  break;
697  case SkillType::Support:
698  icon = paths.getStringValue("supportSkillIcon");
699  break;
701  icon = paths.getStringValue("trapSkillIcon");
702  break;
703  case SkillType::Unknown:
704  icon = paths.getStringValue("unknownSkillIcon");
705  break;
706  default:
707  break;
708  }
709  return icon;
710 }
711 
713  const int id,
714  const std::string &name,
715  const int level,
716  const int range,
717  const Modifiable modifiable,
718  const SkillType::SkillType type,
719  const int sp)
720 {
721  if (mDefaultModel != nullptr)
722  {
723  SkillInfo *const skill = new SkillInfo;
724  skill->id = CAST_U32(id);
725  skill->type = type;
726  skill->owner = owner;
727  SkillData *const data = skill->data;
728  if (name.empty())
729  {
730  data->name = "Unknown skill Id: " + toString(id);
731  data->dispName = data->name;
732  }
733  else
734  {
735  data->name = name;
736  data->dispName = strprintf("%s, %u", name.c_str(), skill->id);
737  }
738  data->description.clear();
739  const std::string icon = getDefaultSkillIcon(type);
740  if (icon.empty())
741  {
742  data->setIcon(paths.getStringValue("missingSkillIcon"));
743  data->haveIcon = false;
744  }
745  else
746  {
747  data->setIcon(icon);
748  data->haveIcon = true;
749  }
751  data->shortName = toString(skill->id);
752  skill->modifiable = modifiable;
753  skill->visible = Visible_false;
754  skill->alwaysVisible = Visible_false;
755  skill->model = mDefaultModel;
756  skill->level = level;
757  // TRANSLATORS: skills dialog. skill level
758  skill->skillLevel = strprintf(_("Lvl: %d"), level);
759  skill->range = range;
760  skill->sp = sp;
761  skill->update();
762  // TRANSLATORS: skills dialog button
763  skill->useButton = _("Use");
764  // TRANSLATORS: skill error message
765  skill->errorText = strprintf(_("Failed skill: %s"), name.c_str());
766  skill->tab = mDefaultTab;
767  mDefaultModel->addSkill(skill);
771 
772  mSkills[id] = skill;
774  }
775 }
776 
777 SkillInfo* SkillDialog::getSkill(const int id) const
778 {
779  SkillMap::const_iterator it = mSkills.find(id);
780  if (it != mSkills.end())
781  return (*it).second;
782  return nullptr;
783 }
784 
785 SkillInfo* SkillDialog::getSkillByItem(const int itemId) const
786 {
787  SkillMap::const_iterator it = mSkills.find(itemId - SKILL_MIN_ID);
788  if (it != mSkills.end())
789  return (*it).second;
790  return nullptr;
791 }
792 
794  const int id,
795  const int duration)
796 {
797  SkillMap::const_iterator it = mSkills.find(id);
798  SkillInfo *info = nullptr;
799  if (it == mSkills.end())
800  {
801  addSkill(owner, id, "", 0, 0, Modifiable_false, SkillType::Unknown, 0);
802  it = mSkills.find(id);
803  }
804  if (it != mSkills.end())
805  {
806  info = (*it).second;
807  }
808  if (info != nullptr)
809  {
810  info->duration = duration;
811  info->durationTime = tick_time;
812  addSkillDuration(info);
813  }
814 }
815 
817 {
818  Window::widgetResized(event);
819 
820  if (mTabs != nullptr)
821  mTabs->adjustSize();
822 }
823 
824 void SkillDialog::useItem(const int itemId,
825  const AutoTarget autoTarget,
826  const int level,
827  const std::string &data) const
828 {
829  const std::map<int, SkillInfo*>::const_iterator
830  it = mSkills.find(itemId - SKILL_MIN_ID);
831  if (it == mSkills.end())
832  return;
833 
834  const SkillInfo *const info = (*it).second;
835  CastTypeT castType = CastType::Default;
836  int offsetX = 0;
837  int offsetY = 0;
838 
839  if (!data.empty())
840  {
841  STD_VECTOR<int> vect;
842  splitToIntVector(vect, data, ' ');
843  const size_t sz = vect.size();
844  if (sz > 0)
845  castType = static_cast<CastTypeT>(vect[0]);
846  if (sz > 2)
847  {
848  offsetX = vect[1];
849  offsetY = vect[2];
850  }
851  }
852  useSkill(info,
853  autoTarget,
854  level,
855  false,
856  std::string(),
857  castType,
858  offsetX,
859  offsetY);
860 }
861 
863 {
864  const SkillTab *const tab = static_cast<SkillTab*>(
865  mTabs->getSelectedTab());
866  if (tab != nullptr)
867  {
868  if (const SkillInfo *const info = tab->getSelectedInfo())
869  {
870  mUseButton->setEnabled(info->range > 0);
872  mUseButton->setCaption(info->useButton);
873  }
874  else
875  {
876  mUseButton->setEnabled(false);
877  // TRANSLATORS: inventory button
878  mUseButton->setCaption(_("Use"));
879  }
880  }
881 }
882 
883 void SkillDialog::updateQuest(const int var,
884  const int val1,
885  const int val2 A_UNUSED,
886  const int val3 A_UNUSED,
887  const int time1 A_UNUSED)
888 {
889  const int id = var + SKILL_VAR_MIN_ID;
890  const SkillMap::const_iterator it = mSkills.find(id);
891 
892  if (it != mSkills.end())
893  {
894  SkillInfo *const info = it->second;
895  if (info != nullptr)
896  {
897  PlayerInfo::setSkillLevel(id, val1);
898  info->level = val1;
899  info->update();
900  }
901  }
902 }
903 
905 {
906  const SkillMap::const_iterator it = mSkills.find(id);
907  if (it != mSkills.end())
908  {
909  SkillInfo *const info = it->second;
910  if (info != nullptr)
911  return info->data;
912  }
913  return nullptr;
914 }
915 
917  const int level) const
918 {
919  const SkillMap::const_iterator it = mSkills.find(id);
920  if (it != mSkills.end())
921  {
922  SkillInfo *const info = it->second;
923  if (info != nullptr)
924  return info->getData1(level);
925  }
926  return nullptr;
927 }
928 
929 void SkillDialog::playUpdateEffect(const int id) const
930 {
931  if (effectManager == nullptr)
932  return;
933  const SkillData *const data = getSkillData(id);
934  if (data == nullptr)
935  return;
937  localPlayer,
938  paths.getIntValue("skillLevelUpEffectId"));
939 }
940 
941 void SkillDialog::playRemoveEffect(const int id) const
942 {
943  if (effectManager == nullptr)
944  return;
945  const SkillData *const data = getSkillData(id);
946  if (data == nullptr)
947  return;
949  localPlayer,
950  paths.getIntValue("skillRemoveEffectId"));
951 }
952 
954  const int level,
955  const int x,
956  const int y,
957  const int delay) const
958 {
959  if (effectManager == nullptr)
960  return;
961  SkillData *const data = getSkillDataByLevel(id, level);
962  if (data == nullptr)
963  return;
965  x * 32,
966  y * 32,
967  cur_time + delay / 1000, // end time in seconds
968  paths.getIntValue("skillCastingGroundEffectId"));
969 }
970 
971 void SkillDialog::useSkill(const int skillId,
972  const AutoTarget autoTarget,
973  int level,
974  const bool withText,
975  const std::string &text,
976  CastTypeT castType,
977  const int offsetX,
978  const int offsetY)
979 {
980  SkillInfo *const info = skillDialog->getSkill(skillId);
981  if (info == nullptr)
982  return;
983  if (castType == CastType::Default)
984  castType = info->customCastType;
985  useSkill(info,
986  autoTarget,
987  level,
988  withText,
989  text,
990  castType,
991  offsetX,
992  offsetY);
993 }
994 
996  const AutoTarget autoTarget,
997  int level,
998  const bool withText,
999  const std::string &text,
1000  const CastTypeT castType,
1001  const int offsetX,
1002  const int offsetY)
1003 {
1004  if ((info == nullptr) || (localPlayer == nullptr))
1005  return;
1006  if (level == 0)
1007  level = info->level;
1008 
1009  const SkillData *data = info->getData1(level);
1010  if (data != nullptr)
1011  {
1012  const std::string cmd = data->invokeCmd;
1013  if (!cmd.empty())
1015  }
1016  switch (castType)
1017  {
1018  default:
1019  case CastType::Default:
1020  useSkillDefault(info,
1021  autoTarget,
1022  level,
1023  withText,
1024  text,
1025  offsetX,
1026  offsetY);
1027  break;
1028  case CastType::Target:
1029  {
1030  const Being *const being = localPlayer->getTarget();
1031  useSkillTarget(info,
1032  autoTarget,
1033  level,
1034  withText,
1035  text,
1036  being,
1037  offsetX,
1038  offsetY);
1039  break;
1040  }
1041  case CastType::Position:
1042  {
1043  int x = 0;
1044  int y = 0;
1045  viewport->getMouseTile(x, y);
1046  useSkillPosition(info,
1047  level,
1048  withText,
1049  text,
1050  x,
1051  y,
1052  offsetX,
1053  offsetY);
1054  break;
1055  }
1056  case CastType::Self:
1057  // +++ probably need call useSkillSelf
1058  useSkillTarget(info,
1059  autoTarget,
1060  level,
1061  withText,
1062  text,
1063  localPlayer,
1064  offsetX,
1065  offsetY);
1066  break;
1067  }
1068 }
1069 
1071  const AutoTarget autoTarget,
1072  int level,
1073  const bool withText,
1074  const std::string &text,
1075  const Being *being,
1076  int offsetX,
1077  int offsetY)
1078 {
1079  SkillType::SkillType type = info->type;
1080  if ((type & SkillType::Attack) != 0)
1081  {
1082  if ((being == nullptr) && autoTarget == AutoTarget_true)
1083  {
1084  if (localPlayer != nullptr)
1085  {
1087  AllowSort_true);
1088  }
1089  }
1090  if (being != nullptr)
1091  {
1092  skillHandler->useBeing(info->id,
1093  level,
1094  being->getId());
1095  }
1096  }
1097  else if ((type & SkillType::Support) != 0)
1098  {
1099  if (being == nullptr)
1100  being = localPlayer;
1101  if (being != nullptr)
1102  {
1103  skillHandler->useBeing(info->id,
1104  level,
1105  being->getId());
1106  }
1107  }
1108  else if ((type & SkillType::Self) != 0)
1109  {
1110  skillHandler->useBeing(info->id,
1111  level,
1112  localPlayer->getId());
1113  }
1114  else if ((type & SkillType::Ground) != 0)
1115  {
1116  if (being == nullptr)
1117  return;
1118  being->fixDirectionOffsets(offsetX, offsetY);
1119  const int x = being->getTileX() + offsetX;
1120  const int y = being->getTileY() + offsetY;
1121  if (info->useTextParameter)
1122  {
1123  if (withText)
1124  {
1125  skillHandler->usePos(info->id,
1126  level,
1127  x, y,
1128  text);
1129  }
1130  else
1131  {
1132  const SkillData *data = info->getData1(level);
1134  x,
1135  y,
1136  level);
1137  TextDialog *const dialog = CREATEWIDGETR(TextDialog,
1138  // TRANSLATORS: text skill dialog header
1139  strprintf(_("Add text to skill %s"),
1140  data->name.c_str()),
1141  // TRANSLATORS: text skill dialog field
1142  _("Text: "),
1143  nullptr,
1144  false);
1145  dialog->setModal(Modal_true);
1146  textSkillListener.setDialog(dialog);
1147  dialog->setActionEventId("ok");
1149  }
1150  }
1151  else
1152  {
1153  skillHandler->usePos(info->id,
1154  level,
1155  x, y);
1156  }
1157  }
1158  else if ((type & SkillType::TargetTrap) != 0)
1159  {
1160  // for now unused
1161  }
1162  else if (type == SkillType::Unknown ||
1163  type == SkillType::Unused)
1164  {
1165  // unknown / unused
1166  }
1167  else
1168  {
1169  reportAlways("Unsupported skill type: %d", type);
1170  }
1171 }
1172 
1174  int level,
1175  const bool withText,
1176  const std::string &text,
1177  const int x,
1178  const int y,
1179  int offsetX,
1180  int offsetY)
1181 {
1182  SkillType::SkillType type = info->type;
1183  if ((type & SkillType::Ground) != 0)
1184  {
1185  localPlayer->fixDirectionOffsets(offsetX, offsetY);
1186  if (info->useTextParameter)
1187  {
1188  if (withText)
1189  {
1190  skillHandler->usePos(info->id,
1191  level,
1192  x + offsetX,
1193  y + offsetY,
1194  text);
1195  }
1196  else
1197  {
1198  const SkillData *data = info->getData1(level);
1200  x + offsetX,
1201  y + offsetY,
1202  level);
1203  TextDialog *const dialog = CREATEWIDGETR(TextDialog,
1204  // TRANSLATORS: text skill dialog header
1205  strprintf(_("Add text to skill %s"),
1206  data->name.c_str()),
1207  // TRANSLATORS: text skill dialog field
1208  _("Text: "),
1209  nullptr,
1210  false);
1211  dialog->setModal(Modal_true);
1212  textSkillListener.setDialog(dialog);
1213  dialog->setActionEventId("ok");
1215  }
1216  }
1217  else
1218  {
1219  skillHandler->usePos(info->id,
1220  level,
1221  x + offsetX,
1222  y + offsetY);
1223  }
1224  }
1225  else if ((type & SkillType::Support) != 0)
1226  {
1227  // wrong type
1228  skillHandler->useBeing(info->id,
1229  level,
1230  localPlayer->getId());
1231  }
1232  else if ((type & SkillType::Self) != 0)
1233  {
1234  skillHandler->useBeing(info->id,
1235  level,
1236  localPlayer->getId());
1237  }
1238  else if ((type & SkillType::Attack) != 0)
1239  {
1240  // do nothing
1241  // +++ probably need select some target on x,y position?
1242  }
1243  else if ((type & SkillType::TargetTrap) != 0)
1244  {
1245  // for now unused
1246  }
1247  else if (type == SkillType::Unknown ||
1248  type == SkillType::Unused)
1249  {
1250  // unknown / unused
1251  }
1252  else
1253  {
1254  reportAlways("Unsupported skill type: %d", type);
1255  }
1256 }
1257 
1259  const AutoTarget autoTarget,
1260  int level,
1261  const bool withText,
1262  const std::string &text,
1263  int offsetX,
1264  int offsetY)
1265 {
1266  SkillType::SkillType type = info->type;
1267  if ((type & SkillType::Attack) != 0)
1268  {
1269  const Being *being = localPlayer->getTarget();
1270  if ((being == nullptr) && autoTarget == AutoTarget_true)
1271  {
1273  AllowSort_true);
1274  }
1275  if (being != nullptr)
1276  {
1277  skillHandler->useBeing(info->id,
1278  level,
1279  being->getId());
1280  }
1281  }
1282  else if ((type & SkillType::Support) != 0)
1283  {
1284  const Being *being = localPlayer->getTarget();
1285  if (being == nullptr)
1286  being = localPlayer;
1287  if (being != nullptr)
1288  {
1289  skillHandler->useBeing(info->id,
1290  level,
1291  being->getId());
1292  }
1293  }
1294  else if ((type & SkillType::Self) != 0)
1295  {
1296  skillHandler->useBeing(info->id,
1297  level,
1298  localPlayer->getId());
1299  }
1300  else if ((type & SkillType::Ground) != 0)
1301  {
1302  int x = 0;
1303  int y = 0;
1304  viewport->getMouseTile(x, y);
1305  localPlayer->fixDirectionOffsets(offsetX, offsetY);
1306  x += offsetX;
1307  y += offsetY;
1308  if (info->useTextParameter)
1309  {
1310  if (withText)
1311  {
1312  skillHandler->usePos(info->id,
1313  level,
1314  x, y,
1315  text);
1316  }
1317  else
1318  {
1319  const SkillData *data = info->getData1(level);
1321  x,
1322  y,
1323  level);
1324  TextDialog *const dialog = CREATEWIDGETR(TextDialog,
1325  // TRANSLATORS: text skill dialog header
1326  strprintf(_("Add text to skill %s"),
1327  data->name.c_str()),
1328  // TRANSLATORS: text skill dialog field
1329  _("Text: "),
1330  nullptr,
1331  false);
1332  dialog->setModal(Modal_true);
1333  textSkillListener.setDialog(dialog);
1334  dialog->setActionEventId("ok");
1336  }
1337  }
1338  else
1339  {
1340  skillHandler->usePos(info->id,
1341  level,
1342  x, y);
1343  }
1344  }
1345  else if ((type & SkillType::TargetTrap) != 0)
1346  {
1347  // for now unused
1348  }
1349  else if (type == SkillType::Unknown ||
1350  type == SkillType::Unused)
1351  {
1352  // unknown / unused
1353  }
1354  else
1355  {
1356  reportAlways("Unsupported skill type: %d", type);
1357  }
1358 }
1359 
1361 {
1362  if (skill == nullptr)
1363  return;
1364 
1365  FOR_EACH (STD_VECTOR<SkillInfo*>::const_iterator, it, mDurations)
1366  {
1367  if ((*it)->id == skill->id)
1368  return;
1369  }
1370  mDurations.push_back(skill);
1371 }
1372 
1374 {
1375  FOR_EACH_SAFE (STD_VECTOR<SkillInfo*>::iterator, it, mDurations)
1376  {
1377  SkillInfo *const skill = *it;
1378  if (skill != nullptr)
1379  {
1380  const int time = get_elapsed_time(skill->durationTime);
1381  if (time >= skill->duration)
1382  {
1383  it = mDurations.erase(it);
1384  skill->cooldown = 0;
1385  skill->duration = 0;
1386  skill->durationTime = 0;
1387  if (it == mDurations.end())
1388  return;
1389  if (it != mDurations.begin())
1390  -- it;
1391  }
1392  else if (time != 0)
1393  {
1394  skill->cooldown = skill->duration * 100 / time;
1395  }
1396  }
1397  }
1398 }
1399 
1400 void SkillDialog::selectSkillLevel(const int skillId,
1401  const int level)
1402 {
1403  SkillInfo *const info = getSkill(skillId);
1404  if (info == nullptr)
1405  return;
1406  if (level > info->level)
1407  info->customSelectedLevel = info->level;
1408  else
1409  info->customSelectedLevel = level;
1410  info->update();
1411 }
1412 
1413 void SkillDialog::selectSkillCastType(const int skillId,
1414  const CastTypeT type)
1415 {
1416  SkillInfo *const info = getSkill(skillId);
1417  if (info == nullptr)
1418  return;
1419  info->customCastType = type;
1420  info->update();
1421 }
1422 
1423 void SkillDialog::setSkillOffsetX(const int skillId,
1424  const int offset)
1425 {
1426  SkillInfo *const info = getSkill(skillId);
1427  if (info == nullptr)
1428  return;
1429  info->customOffsetX = offset;
1430  info->update();
1431 }
1432 
1433 void SkillDialog::setSkillOffsetY(const int skillId,
1434  const int offset)
1435 {
1436  SkillInfo *const info = getSkill(skillId);
1437  if (info == nullptr)
1438  return;
1439  info->customOffsetY = offset;
1440  info->update();
1441 }
Net::PlayerHandler * playerHandler
Definition: net.cpp:89
const bool AutoTarget_true
Definition: autotarget.h:29
void adjustTabPositions()
Definition: tabbedarea.cpp:596
#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:719
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:208
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:228
bool useTextParameter
Definition: skillinfo.h:82
#define fromInt(val, name)
Definition: intdefines.h:45
std::string fileName
Definition: testmain.cpp:36
TabbedArea * mTabs
Definition: skilldialog.h:226
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:232
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:230
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:94
std::string castingWaterAction
Definition: skillinfo.h:58
Configuration config
int getProperty(const xmlNodePtr node, const char *const name, int def)
Definition: libxml.cpp:171
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:95
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
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:187
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:214
Net::SkillHandler * skillHandler
Definition: net.cpp:90
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
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:266
static const std::string CAST("cast")
void selectSkillLevel(const int skillId, const int level)
uint32_t data
Button * mUseButton
Definition: skilldialog.h:229
void clearSkills()
LocalPlayer * localPlayer
void setSelectedTabDefault()
Definition: tabbedarea.cpp:423
bool unknownSkillsAutoTab
Definition: settings.h:162
SoundInfo soundMiss
Definition: skilldata.h:44
SkillModel * mDefaultModel
Definition: skilldialog.h:231
std::list< Tab * > mDeleteTabs
Definition: skilldialog.h:227
#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:166
void action(const ActionEvent &event)
void addSkillDuration(SkillInfo *const skill)
void fixDirectionOffsets(int &offsetX, int &offsetY) const
Definition: being.cpp:5498
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:255
int missEffectId
Definition: skilldata.h:51
#define A_UNUSED
Definition: localconsts.h:171
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:559
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:224
#define CREATEWIDGETR(type,...)
Definition: createwidget.h:35
void log(const char *const log_text,...)
Definition: logger.cpp:243
std::vector< SkillInfo * > mDurations
Definition: skilldialog.h:225
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:229
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)