diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-07-19 22:05:41 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-07-19 22:30:18 -0600 |
commit | 5141dc4a99b74358f2dd0f5f211c5069a630ce1b (patch) | |
tree | 647cfb05d179d61759ef3679482eb204a7853d34 /src/localplayer.cpp | |
parent | 2e8fca7d471b4e2bf20735a0669e96722c000669 (diff) | |
download | mana-client-5141dc4a99b74358f2dd0f5f211c5069a630ce1b.tar.gz mana-client-5141dc4a99b74358f2dd0f5f211c5069a630ce1b.tar.bz2 mana-client-5141dc4a99b74358f2dd0f5f211c5069a630ce1b.tar.xz mana-client-5141dc4a99b74358f2dd0f5f211c5069a630ce1b.zip |
Merge StatusWindows
Also some other small merges
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r-- | src/localplayer.cpp | 97 |
1 files changed, 75 insertions, 22 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 970204d0..cba27569 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -40,12 +40,8 @@ #include "gui/ministatus.h" #include "gui/palette.h" #include "gui/skilldialog.h" -#include "gui/storagewindow.h" -#ifdef TMWSERV_SUPPORT #include "gui/statuswindow.h" -#else -#include "gui/status.h" -#endif +#include "gui/storagewindow.h" #include "gui/widgets/chattab.h" @@ -83,17 +79,9 @@ const short walkingKeyboardDelay = 40; LocalPlayer *player_node = NULL; -#ifdef TMWSERV_SUPPORT -LocalPlayer::LocalPlayer(): - Player(65535, 0, NULL), -#else LocalPlayer::LocalPlayer(int id, int job, Map *map): Player(id, job, map), - mCharId(0), - mJobXp(0), - mJobLevel(0), - mXpForNextLevel(0), mJobXpForNextLevel(0), - mMp(0), mMaxMp(0), +#ifdef EATHENA_SUPPORT mAttackRange(0), #endif mEquipment(new Equipment), @@ -102,10 +90,11 @@ LocalPlayer::LocalPlayer(int id, int job, Map *map): mTargetTime(-1), #endif mLastTarget(-1), - mCharacterPoints(-1), - mCorrectionPoints(-1), - mLevelProgress(0), + mCharacterPoints(0), + mCorrectionPoints(0), mLevel(1), + mExp(0), mExpNeeded(0), + mMp(0), mMaxMp(0), mMoney(0), mTotalWeight(1), mMaxWeight(1), mHp(1), mMaxHp(1), @@ -816,6 +805,22 @@ void LocalPlayer::setAttributeEffective(int num, int value) statusWindow->update(num); } +void LocalPlayer::setCharacterPoints(int n) +{ + mCharacterPoints = n; + + if (statusWindow) + statusWindow->update(StatusWindow::CHAR_POINTS); +} + +void LocalPlayer::setCorrectionPoints(int n) +{ + mCorrectionPoints = n; + + if (statusWindow) + statusWindow->update(StatusWindow::CHAR_POINTS); +} + void LocalPlayer::setSkillPoints(int points) { mSkillPoints = points; @@ -846,16 +851,64 @@ std::pair<int, int> LocalPlayer::getExperience(int skill) return mSkillExp[skill]; } -void LocalPlayer::setLevelProgress(int percent) +void LocalPlayer::setHp(int value) +{ + mHp = value; + + if (statusWindow) + statusWindow->update(StatusWindow::HP); +} + +void LocalPlayer::setMaxHp(int value) { - if (mMap && percent > mLevelProgress) + mMaxHp = value; + + if (statusWindow) + statusWindow->update(StatusWindow::HP); +} + +void LocalPlayer::setLevel(int value) +{ + mLevel = value; + + if (statusWindow) + statusWindow->update(StatusWindow::LEVEL); +} + +void LocalPlayer::setExp(int value) +{ + if (mMap && value > mExp) { - addMessageToQueue(toString(percent - mLevelProgress) + " xp"); + addMessageToQueue(toString(value - mExp) + " xp"); } - mLevelProgress = percent; + mExp = value; + + if (statusWindow) + statusWindow->update(StatusWindow::EXP); +} + +void LocalPlayer::setExpNeeded(int value) +{ + mExpNeeded = value; + + if (statusWindow) + statusWindow->update(StatusWindow::EXP); +} + +int LocalPlayer::setMP(int value) +{ + mMp = value; + + if (statusWindow) + statusWindow->update(StatusWindow::MP); +} + +int LocalPlayer::setMaxMP(int value) +{ + mMaxMp = value; if (statusWindow) - statusWindow->update(); + statusWindow->update(StatusWindow::MP); } void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount) |