diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/gui/skill.cpp | 3 | ||||
-rw-r--r-- | src/localplayer.cpp | 32 | ||||
-rw-r--r-- | src/localplayer.h | 2 |
4 files changed, 41 insertions, 2 deletions
@@ -1,3 +1,9 @@ +2008-02-22 Philipp Sehmisch <tmw@crushnet.org> + + * src/gui/skill.cpp, src/localplayer.cpp, src/localplayer.h: + Implemented skill name display in skill dialog and xp messages (based + on a patch by rodge) + 2008-02-21 Philipp Sehmisch <tmw@crushnet.org> * data/items.xml: Gave the hair sprites and the player sprite the diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index 7e1ed49d..28a18723 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -102,7 +102,8 @@ void SkillDialog::update() std::pair<int, int> exp = player_node->getExperience(a); std::string sExp (toString(exp.first) + " / " + toString(exp.second)); - mSkillNameLabels.at(a)->setCaption("Skill" + toString(a)); + + mSkillNameLabels.at(a)->setCaption(LocalPlayer::getSkillName(a)); mSkillNameLabels.at(a)->adjustSize(); mSkillLevelLabels.at(a)->setCaption(skillLevel); mSkillLevelLabels.at(a)->adjustSize(); diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 085c80c5..5a6457a4 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -380,12 +380,42 @@ void LocalPlayer::lowerAttribute(size_t attr) Net::GameServer::Player::lowerAttribute(attr + CHAR_ATTR_BEGIN); } +const std::string& LocalPlayer::getSkillName(int skill) +{ + static const std::string skills[CHAR_SKILL_NB + 1] = + { "Unarmed", // CHAR_SKILL_WEAPON_NONE + "Knife", // CHAR_SKILL_WEAPON_KNIFE + "Sword", // CHAR_SKILL_WEAPON_SWORD + "Polearm", // CHAR_SKILL_WEAPON_POLEARM + "Staff", // CHAR_SKILL_WEAPON_STAFF + "Whip", // CHAR_SKILL_WEAPON_WHIP + "Bow", // CHAR_SKILL_WEAPON_BOW + "Shooting", // CHAR_SKILL_WEAPON_SHOOTING + "Mace", // CHAR_SKILL_WEAPON_MACE + "Axe", // CHAR_SKILL_WEAPON_AXE + "Thrown", // CHAR_SKILL_WEAPON_THROWN + "Magic", // CHAR_SKILL_MAGIC_IAMJUSTAPLACEHOLDER + "Craft", // CHAR_SKILL_CRAFT_IAMJUSTAPLACEHOLDER + "Unknown Skill" + }; + + if ((skill < 0) || (skill > CHAR_SKILL_NB)) + { + return skills[CHAR_SKILL_NB]; + } + else + { + return skills[skill]; + } + +} + void LocalPlayer::setExperience(int skill, int current, int next) { int diff = current - mExpCurrent.at(skill); if (mMap && mExpCurrent.at(skill) != -1 && diff > 0) { - const std::string text = toString(diff) + " xp skill" + toString(skill); + const std::string text = toString(diff) + " " + getSkillName(skill) + " xp"; mExpMessages.push_back(text); } diff --git a/src/localplayer.h b/src/localplayer.h index 548325dc..fc528171 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -323,6 +323,8 @@ class LocalPlayer : public Player void setExperience(int skill, int current, int next); + static const std::string& getSkillName(int skill); + std::pair<int, int> getExperience(int skill); float mLastAttackTime; /**< Used to synchronize the charge dialog */ |