summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-09-27 22:35:38 +0300
committerAndrei Karas <akaras@inbox.ru>2017-09-27 22:35:38 +0300
commit9429dc4f5b5b6102a8b575de25ce5d8e7170551f (patch)
treed4603ddbea06f75e8637a1ff94da4432d7b96951 /src/being
parent64d30eda264c342aced8d791b47a35def0e4d15c (diff)
downloadManaVerse-9429dc4f5b5b6102a8b575de25ce5d8e7170551f.tar.gz
ManaVerse-9429dc4f5b5b6102a8b575de25ce5d8e7170551f.tar.bz2
ManaVerse-9429dc4f5b5b6102a8b575de25ce5d8e7170551f.tar.xz
ManaVerse-9429dc4f5b5b6102a8b575de25ce5d8e7170551f.zip
Change player job level, exp from stat object to attribute.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/localplayer.cpp37
-rw-r--r--src/being/localplayer.h8
-rw-r--r--src/being/playerinfo.cpp2
3 files changed, 20 insertions, 27 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;
}
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index 9af5b9d3c..897e4dc00 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -34,7 +34,6 @@
#include "listeners/actorspritelistener.h"
#include "listeners/attributelistener.h"
#include "listeners/playerdeathlistener.h"
-#include "listeners/statlistener.h"
#include "localconsts.h"
@@ -50,8 +49,7 @@ class OkDialog;
class LocalPlayer final : public Being,
public ActorSpriteListener,
public AttributeListener,
- public PlayerDeathListener,
- public StatListener
+ public PlayerDeathListener
{
public:
/**
@@ -402,10 +400,6 @@ class LocalPlayer final : public Being,
const int64_t oldVal,
const int64_t newVal) override final;
- void statChanged(const AttributesT id,
- const int oldVal1,
- const int oldVal2) override final;
-
void updateMusic() const;
void setAfkTime(const int v) noexcept2
diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp
index f24d97331..0a89bd7e1 100644
--- a/src/being/playerinfo.cpp
+++ b/src/being/playerinfo.cpp
@@ -33,6 +33,8 @@
#include "gui/windows/inventorywindow.h"
#include "gui/windows/npcdialog.h"
+#include "listeners/statlistener.h"
+
#include "net/homunculushandler.h"
#include "net/inventoryhandler.h"
#include "net/mercenaryhandler.h"