diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-09-27 22:35:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-09-27 22:35:38 +0300 |
commit | 9429dc4f5b5b6102a8b575de25ce5d8e7170551f (patch) | |
tree | d4603ddbea06f75e8637a1ff94da4432d7b96951 /src/being/localplayer.cpp | |
parent | 64d30eda264c342aced8d791b47a35def0e4d15c (diff) | |
download | plus-9429dc4f5b5b6102a8b575de25ce5d8e7170551f.tar.gz plus-9429dc4f5b5b6102a8b575de25ce5d8e7170551f.tar.bz2 plus-9429dc4f5b5b6102a8b575de25ce5d8e7170551f.tar.xz plus-9429dc4f5b5b6102a8b575de25ce5d8e7170551f.zip |
Change player job level, exp from stat object to attribute.
Diffstat (limited to 'src/being/localplayer.cpp')
-rw-r--r-- | src/being/localplayer.cpp | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index e1ba96893..2fc20f6f2 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -116,7 +116,6 @@ LocalPlayer::LocalPlayer(const BeingId id, ActorSpriteListener(), AttributeListener(), PlayerDeathListener(), - StatListener(), mMoveState(0), mLastTargetX(0), mLastTargetY(0), @@ -1226,25 +1225,6 @@ void LocalPlayer::addSpMessage(const int change) } } -void LocalPlayer::statChanged(const AttributesT id, - const int oldVal1, - const int oldVal2) -{ - if (!mShowJobExp || - id != Attributes::PLAYER_JOB || - Net::getNetworkType() != ServerType::TMWATHENA) - { - return; - } - - const std::pair<int, int> exp = PlayerInfo::getStatExperience(id); - if (oldVal1 > exp.first || (oldVal2 == 0)) - return; - - const int change = exp.first - oldVal1; - addJobMessage(change); -} - void LocalPlayer::attributeChanged(const AttributesT id, const int64_t oldVal, const int64_t newVal) @@ -1271,6 +1251,23 @@ void LocalPlayer::attributeChanged(const AttributesT id, if (oldVal != 0 && newVal == 0) PlayerDeathListener::distributeEvent(); break; + case Attributes::PLAYER_JOB_EXP: + { + if (!mShowJobExp || + Net::getNetworkType() != ServerType::TMWATHENA) + { + return; + } + if (oldVal > newVal || + PlayerInfo::getAttribute( + Attributes::PLAYER_JOB_EXP_NEEDED) == 0) + { + return; + } + const int64_t change = newVal - oldVal; + addJobMessage(change); + break; + } default: break; } |