diff options
-rw-r--r-- | src/localplayer.cpp | 10 | ||||
-rw-r--r-- | src/localplayer.h | 4 | ||||
-rw-r--r-- | src/net/ea/charserverhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/manaserv/charhandler.cpp | 4 |
4 files changed, 12 insertions, 10 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp index f6803973..6c36fa1c 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -817,7 +817,7 @@ void LocalPlayer::lowerAttribute(size_t attr) Net::getPlayerHandler()->decreaseAttribute(attr); } -void LocalPlayer::setAttributeBase(int num, int value) +void LocalPlayer::setAttributeBase(int num, int value, bool notify) { int old = mAttributeBase[num]; @@ -827,7 +827,8 @@ void LocalPlayer::setAttributeBase(int num, int value) if (skillDialog->update(num).empty() || !(value > old)) return; - effectManager->trigger(1, this); + if (old != 0 && notify) + effectManager->trigger(1, this); } if (statusWindow) @@ -867,7 +868,7 @@ void LocalPlayer::setSkillPoints(int points) skillDialog->update(); } -void LocalPlayer::setExperience(int skill, int current, int next) +void LocalPlayer::setExperience(int skill, int current, int next, bool notify) { std::pair<int, int> cur = getExperience(skill); int diff = current - cur.first; @@ -875,11 +876,12 @@ void LocalPlayer::setExperience(int skill, int current, int next) cur = std::pair<int, int>(current, next); mSkillExp[skill] = cur; + std::string name; if (skillDialog) name = skillDialog->update(skill); - if (mMap && cur.first != -1 && diff > 0 && !name.empty()) + if (mMap && notify && cur.first != -1 && diff > 0 && !name.empty()) { addMessageToQueue(strprintf("%d %s xp", diff, name.c_str())); } diff --git a/src/localplayer.h b/src/localplayer.h index 52e3597e..fe3e3d98 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -327,7 +327,7 @@ class LocalPlayer : public Player int getAttributeBase(int num) { return mAttributeBase[num]; } - void setAttributeBase(int num, int value); + void setAttributeBase(int num, int value, bool notify = true); int getAttributeEffective(int num) { return mAttributeEffective[num]; } @@ -349,7 +349,7 @@ class LocalPlayer : public Player void setSkillPoints(int points); - void setExperience(int skill, int current, int next); + void setExperience(int skill, int current, int next, bool notify = true); std::pair<int, int> getExperience(int skill); diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index b671db23..a8a5260f 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -189,7 +189,7 @@ LocalPlayer *CharServerHandler::readPlayerData(Net::MessageIn &msg, int &slot) tempPlayer->setMoney(msg.readInt32()); tempPlayer->setExperience(JOB, msg.readInt32(), 1); int temp = msg.readInt32(); - tempPlayer->setAttributeBase(JOB, temp); + tempPlayer->setAttributeBase(JOB, temp, false); tempPlayer->setAttributeEffective(JOB, temp); tempPlayer->setSprite(Player::SHOE_SPRITE, msg.readInt16()); tempPlayer->setSprite(Player::GLOVES_SPRITE, msg.readInt16()); @@ -218,7 +218,7 @@ LocalPlayer *CharServerHandler::readPlayerData(Net::MessageIn &msg, int &slot) tempPlayer->setSprite(Player::MISC2_SPRITE, msg.readInt16()); tempPlayer->setName(msg.readString(24)); for (int i = 0; i < 6; i++) - tempPlayer->setAttributeBase(i + STR, msg.readInt8()); + tempPlayer->setAttributeBase(i + STR, msg.readInt8(), false); slot = msg.readInt8(); // character slot msg.readInt8(); // unknown diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp index 06c81c9e..622fceaa 100644 --- a/src/net/manaserv/charhandler.cpp +++ b/src/net/manaserv/charhandler.cpp @@ -166,7 +166,7 @@ void CharHandler::handleMessage(Net::MessageIn &msg) for (int i = 0; i < 7; i++) { - tempPlayer->setAttributeBase(i, info.attr[i]); + tempPlayer->setAttributeBase(i, info.attr[i], false); } mCharInfo->setEntry(tempPlayer); @@ -341,7 +341,7 @@ void CharHandler::getCharacters() for (int i = 0; i < 7; i++) { - tempPlayer->setAttributeBase(i, info.attr[i]); + tempPlayer->setAttributeBase(i, info.attr[i], false); } mCharInfo->setEntry(tempPlayer); |