From 51583912458f8eb0b080edabf3af5f384a205055 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 22 Nov 2015 19:46:08 +0300 Subject: Use selected skill level in button "use" in skill dialog. --- src/gui/windows/skilldialog.cpp | 29 ++++++++++++++++++----------- src/gui/windows/skilldialog.h | 3 ++- 2 files changed, 20 insertions(+), 12 deletions(-) (limited to 'src/gui/windows') diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 49b89c951..9949ba859 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -171,7 +171,8 @@ void SkillDialog::action(const ActionEvent &event) { const SkillInfo *const info = tab->getSelectedInfo(); useSkill(info, - fromBool(config.getBoolValue("skillAutotarget"), AutoTarget)); + fromBool(config.getBoolValue("skillAutotarget"), AutoTarget), + info->selectedLevel); } } else if (eventId == "close") @@ -569,7 +570,8 @@ void SkillDialog::useItem(const int itemId, return; const SkillInfo *const info = (*it).second; - useSkill(info, autoTarget); + // +++ need add skill level here + useSkill(info, autoTarget, 0); } void SkillDialog::updateTabSelection() @@ -702,13 +704,15 @@ void SkillDialog::playCastingDstTileEffect(const int id, } void SkillDialog::useSkill(const SkillInfo *const info, - const AutoTarget autoTarget) + const AutoTarget autoTarget, + int level) { if (!info || !localPlayer) return; - const SkillData *data = info->data; - if (!data) - data = info->getData1(info->level); + if (!level) + level = info->level; + + const SkillData *data = info->getData1(level); if (data) { const std::string cmd = data->invokeCmd; @@ -730,7 +734,8 @@ void SkillDialog::useSkill(const SkillInfo *const info, if (being) { skillHandler->useBeing(info->id, - info->level, being->getId()); + level, + being->getId()); } break; } @@ -742,13 +747,15 @@ void SkillDialog::useSkill(const SkillInfo *const info, if (being) { skillHandler->useBeing(info->id, - info->level, being->getId()); + level, + being->getId()); } break; } case SkillType::Self: skillHandler->useBeing(info->id, - info->level, localPlayer->getId()); + level, + localPlayer->getId()); break; case SkillType::Ground: @@ -761,7 +768,7 @@ void SkillDialog::useSkill(const SkillInfo *const info, textSkillListener.setSkill(info->id, x, y, - info->level); + level); TextDialog *const dialog = CREATEWIDGETR(TextDialog, // TRANSLATORS: text skill dialog header strprintf(_("Add text to skill %s"), @@ -776,7 +783,7 @@ void SkillDialog::useSkill(const SkillInfo *const info, else { skillHandler->usePos(info->id, - info->level, + level, x, y); } break; diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h index 47458e2db..1cf92b586 100644 --- a/src/gui/windows/skilldialog.h +++ b/src/gui/windows/skilldialog.h @@ -140,7 +140,8 @@ class SkillDialog final : public Window, void removeSkill(const int id); static void useSkill(const SkillInfo *const info, - const AutoTarget autoTarget); + const AutoTarget autoTarget, + int level); SkillData *getSkillData(const int id) const; -- cgit v1.2.3-70-g09d2