From c9795055ee1b6079ef9b0c0e3faf4bb79704bd98 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 25 Jul 2016 02:30:47 +0300 Subject: Add into player attributes prefix PLAYER_. --- src/being/being.cpp | 4 ++-- src/being/localplayer.cpp | 16 ++++++++-------- src/being/playerinfo.cpp | 18 +++++++++++------- 3 files changed, 21 insertions(+), 17 deletions(-) (limited to 'src/being') diff --git a/src/being/being.cpp b/src/being/being.cpp index 935c2112c..b91b40844 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -3725,8 +3725,8 @@ void Being::drawPlayerSpriteAt(Graphics *restrict const graphics, mAction != BeingAction::DEAD) { drawHpBar(graphics, - PlayerInfo::getAttribute(Attributes::MAX_HP), - PlayerInfo::getAttribute(Attributes::HP), + PlayerInfo::getAttribute(Attributes::PLAYER_MAX_HP), + PlayerInfo::getAttribute(Attributes::PLAYER_HP), 0, UserColorId::PLAYER_HP, UserColorId::PLAYER_HP2, diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index e065fafe4..3ae1cd90b 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -194,9 +194,9 @@ LocalPlayer::LocalPlayer(const BeingId id, else mNameColor = nullptr; - PlayerInfo::setStatBase(Attributes::WALK_SPEED, + PlayerInfo::setStatBase(Attributes::PLAYER_WALK_SPEED, getWalkSpeed()); - PlayerInfo::setStatMod(Attributes::WALK_SPEED, 0); + PlayerInfo::setStatMod(Attributes::PLAYER_WALK_SPEED, 0); loadHomes(); @@ -1167,7 +1167,7 @@ void LocalPlayer::statChanged(const AttributesT id, const int oldVal2) { if (!mShowJobExp || - id != Attributes::JOB || + id != Attributes::PLAYER_JOB || serverFeatures->haveExpPacket()) { return; @@ -1189,7 +1189,7 @@ void LocalPlayer::attributeChanged(const AttributesT id, PRAGMA45(GCC diagnostic ignored "-Wswitch-enum") switch (id) { - case Attributes::EXP: + case Attributes::PLAYER_EXP: { if (serverFeatures->haveExpPacket()) break; @@ -1200,10 +1200,10 @@ void LocalPlayer::attributeChanged(const AttributesT id, addXpMessage(change); break; } - case Attributes::LEVEL: + case Attributes::PLAYER_LEVEL: mLevel = newVal; break; - case Attributes::HP: + case Attributes::PLAYER_HP: if (oldVal != 0 && newVal == 0) PlayerDeathListener::distributeEvent(); break; @@ -1677,7 +1677,7 @@ void LocalPlayer::tryMagic(const std::string &spell, const int baseMagic, if (PlayerInfo::getSkillLevel(340) >= baseMagic && PlayerInfo::getSkillLevel(342) >= schoolMagic) { - if (PlayerInfo::getAttribute(Attributes::MP) >= mana) + if (PlayerInfo::getAttribute(Attributes::PLAYER_MP) >= mana) { if (!PacketLimiter::limitPackets(PacketType::PACKET_CHAT)) return; @@ -2562,7 +2562,7 @@ void LocalPlayer::respawn() int LocalPlayer::getLevel() const { - return PlayerInfo::getAttribute(Attributes::LEVEL); + return PlayerInfo::getAttribute(Attributes::PLAYER_LEVEL); } void LocalPlayer::updateNavigateList() diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp index 68b3ee8e1..6ed4fceba 100644 --- a/src/being/playerinfo.cpp +++ b/src/being/playerinfo.cpp @@ -398,18 +398,22 @@ void setTrading(const Trading trading) void updateAttrs() { - const int attackDelay = getStatBase(Attributes::ATTACK_DELAY); + const int attackDelay = getStatBase(Attributes::PLAYER_ATTACK_DELAY); if (attackDelay) { - setStatBase(Attributes::ATTACK_SPEED, - getStatBase(Attributes::ATK) * 1000 / attackDelay, Notify_false); - setStatMod(Attributes::ATTACK_SPEED, - getStatMod(Attributes::ATK) * 1000 / attackDelay, Notify_true); + setStatBase(Attributes::PLAYER_ATTACK_SPEED, + getStatBase(Attributes::PLAYER_ATK) * 1000 / attackDelay, + Notify_false); + setStatMod(Attributes::PLAYER_ATTACK_SPEED, + getStatMod(Attributes::PLAYER_ATK) * 1000 / attackDelay, + Notify_true); } else { - setStatBase(Attributes::ATTACK_SPEED, 0, Notify_false); - setStatMod(Attributes::ATTACK_SPEED, 0, Notify_true); + setStatBase(Attributes::PLAYER_ATTACK_SPEED, 0, + Notify_false); + setStatMod(Attributes::PLAYER_ATTACK_SPEED, 0, + Notify_true); } } -- cgit v1.2.3-60-g2f50