summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2008-02-22 15:58:41 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2008-02-22 15:58:41 +0000
commit49eb5c5779885e6b7580c0e8459609fb228c3ec8 (patch)
tree7ceef20e0f4e5d6797a15d4f9437ae6acec85ade
parent3f0b0c1216f5e7a8947ff84f028c5c68e872636d (diff)
downloadmana-client-49eb5c5779885e6b7580c0e8459609fb228c3ec8.tar.gz
mana-client-49eb5c5779885e6b7580c0e8459609fb228c3ec8.tar.bz2
mana-client-49eb5c5779885e6b7580c0e8459609fb228c3ec8.tar.xz
mana-client-49eb5c5779885e6b7580c0e8459609fb228c3ec8.zip
Implemented skill name display in skill dialog and xp messages (based on a patch by rodge)
-rw-r--r--ChangeLog6
-rw-r--r--src/gui/skill.cpp3
-rw-r--r--src/localplayer.cpp32
-rw-r--r--src/localplayer.h2
4 files changed, 41 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a710e00e..e26d757a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 */