summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-07-13 19:52:12 -0600
committerJared Adams <jaxad0127@gmail.com>2009-07-13 19:52:12 -0600
commit666211542df4fd4fb0f9a1c936b54f6405ef09ba (patch)
tree478ea55ae467406f2f90f8941a2c5bc2a74a48db /src/localplayer.cpp
parent6c764b3c95d0c078c5ccebac607517353e64dc55 (diff)
downloadmana-666211542df4fd4fb0f9a1c936b54f6405ef09ba.tar.gz
mana-666211542df4fd4fb0f9a1c936b54f6405ef09ba.tar.bz2
mana-666211542df4fd4fb0f9a1c936b54f6405ef09ba.tar.xz
mana-666211542df4fd4fb0f9a1c936b54f6405ef09ba.zip
Some item pickup cleaning
Still need to find where to attach LocalPlayer::pickedUp for TMWServ.
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp47
1 files changed, 34 insertions, 13 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 69049398..fd0c0264 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -42,6 +42,8 @@
#include "gui/skilldialog.h"
#include "gui/storagewindow.h"
+#include "gui/widgets/chattab.h"
+
#include "net/inventoryhandler.h"
#include "net/net.h"
#include "net/partyhandler.h"
@@ -161,13 +163,15 @@ void LocalPlayer::logic()
{
//const Vector &pos = getPosition();
+ MessagePair info = mMessages.front();
+
particleEngine->addTextRiseFadeOutEffect(
- mMessages.front(),
+ info.first,
/*(int) pos.x,
(int) pos.y - 48,*/
getPixelX(),
getPixelY() - 48,
- &guiPalette->getColor(Palette::EXP_INFO),
+ &guiPalette->getColor(info.second),
gui->getInfoParticleFont(), true);
mMessages.pop_front();
@@ -850,17 +854,33 @@ void LocalPlayer::setLevelProgress(int percent)
mLevelProgress = percent;
}
-void LocalPlayer::pickedUp(const std::string &item)
+void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount)
{
- if (mMap)
+ if (!amount)
+ {
+ if (config.getValue("showpickupchat", 1))
+ {
+ localChatTab->chatLog(_("Unable to pick up item."), BY_SERVER);
+ }
+ }
+ else
{
- // Show pickup notification
- particleEngine->addTextRiseFadeOutEffect(
- item,
- getPixelX(),
- getPixelY() - 48,
- &guiPalette->getColor(Palette::PICKUP_INFO),
- gui->getInfoParticleFont(), true);
+ // TRANSLATORS: Used as in "You picked up a ...", when picking up
+ // only one item.
+ const std::string amountStr = (amount > 1) ? toString(amount) : _("a");
+
+ if (config.getValue("showpickupchat", 1))
+ {
+ localChatTab->chatLog(strprintf(_("You picked up %s [@@%d|%s@@]."),
+ amountStr.c_str(), itemInfo.getId(),
+ itemInfo.getName().c_str()), BY_SERVER);
+ }
+
+ if (mMap && config.getValue("showpickupparticle", 0))
+ {
+ // Show pickup notification
+ addMessageToQueue(itemInfo.getName(), Palette::PICKUP_INFO);
+ }
}
}
@@ -1010,7 +1030,8 @@ void LocalPlayer::setInStorage(bool inStorage)
}
#endif
-void LocalPlayer::addMessageToQueue(const std::string &message)
+void LocalPlayer::addMessageToQueue(const std::string &message,
+ Palette::ColorType color)
{
- mMessages.push_back(message);
+ mMessages.push_back(MessagePair(message, color));
}