diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-23 21:10:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-23 21:10:27 +0300 |
commit | ec5a45824c26921c12a1a90dfe541c2e59421e7b (patch) | |
tree | 7443abd5e6710bb5abdf4ef2f78af04d9fdb920b | |
parent | 06ffa695ca77de549520fa03c500c7d88f21c0c4 (diff) | |
download | mv-ec5a45824c26921c12a1a90dfe541c2e59421e7b.tar.gz mv-ec5a45824c26921c12a1a90dfe541c2e59421e7b.tar.bz2 mv-ec5a45824c26921c12a1a90dfe541c2e59421e7b.tar.xz mv-ec5a45824c26921c12a1a90dfe541c2e59421e7b.zip |
eathena: if skill fail, show errorText from skill.
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 2 | ||||
-rw-r--r-- | src/net/eathena/skillhandler.cpp | 66 |
2 files changed, 14 insertions, 54 deletions
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 1fb07e37d..0fa3e6bbb 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -448,7 +448,7 @@ void SkillDialog::addSkill(const SkillOwner::Type owner, skill->sp = sp; skill->update(); skill->useButton = _("Use"); - skill->errorText = name; + skill->errorText = strprintf(_("Failed skill: %s"), name.c_str()); mDefaultModel->addSkill(skill); mSkills[id] = skill; diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp index e5025cd9a..1b61559d3 100644 --- a/src/net/eathena/skillhandler.cpp +++ b/src/net/eathena/skillhandler.cpp @@ -27,6 +27,8 @@ #include "being/localplayer.h" #include "being/playerinfo.h" +#include "gui/widgets/skillinfo.h" + #include "gui/windows/skilldialog.h" #include "net/eathena/messageout.h" @@ -206,8 +208,7 @@ void SkillHandler::processSkillFailed(Net::MessageIn &msg) } std::string txt; - if (success == static_cast<int>(SKILL_FAILED) - && skillId == static_cast<int>(SKILL_BASIC)) + if (success == static_cast<int>(SKILL_FAILED) && bskill != 0) { if (localPlayer && bskill == static_cast<int>(BSKILL_EMOTE) && reason == static_cast<int>(RFAIL_SKILLDEP)) @@ -215,38 +216,11 @@ void SkillHandler::processSkillFailed(Net::MessageIn &msg) localPlayer->stopAdvert(); } - switch (bskill) - { - case BSKILL_TRADE: - // TRANSLATORS: error message - txt = _("Trade failed!"); - break; - case BSKILL_EMOTE: - // TRANSLATORS: error message - txt = _("Emote failed!"); - break; - case BSKILL_SIT: - // TRANSLATORS: error message - txt = _("Sit failed!"); - break; - case BSKILL_CREATECHAT: - // TRANSLATORS: error message - txt = _("Chat creating failed!"); - break; - case BSKILL_JOINPARTY: - // TRANSLATORS: error message - txt = _("Could not join party!"); - break; - case BSKILL_SHOUT: - // TRANSLATORS: error message - txt = _("Cannot shout!"); - break; - default: - logger->log("QQQ SMSG_SKILL_FAILED: bskill " - + toString(bskill)); - break; - } - + SkillInfo *const info = skillDialog->getSkill(bskill); + if (info) + txt = info->errorText; + else + txt = strprintf(_("Unknown skill error: %d"), bskill); txt.append(" "); switch (reason) @@ -302,25 +276,11 @@ void SkillHandler::processSkillFailed(Net::MessageIn &msg) } else { - switch (skillId) - { - case SKILL_WARP : - // TRANSLATORS: error message - txt = _("Warp failed..."); - break; - case SKILL_STEAL : - // TRANSLATORS: error message - txt = _("Could not steal anything..."); - break; - case SKILL_ENVENOM : - // TRANSLATORS: error message - txt = _("Poison had no effect..."); - break; - default: - logger->log("QQQ SMSG_SKILL_FAILED: skillId " - + toString(skillId)); - break; - } + SkillInfo *const info = skillDialog->getSkill(skillId); + if (info) + txt = info->errorText; + else + txt = strprintf(_("Unknown skill error: %d"), skillId); } NotifyManager::notify(NotifyTypes::SKILL_FAIL_MESSAGE, txt); |