summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 3550b092..3df80f0b 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -30,8 +30,10 @@
#include "particle.h"
#include "sound.h"
#include "monster.h"
+#include "statuseffect.h"
#include "gui/gui.h"
+#include "gui/ministatus.h"
#include "net/messageout.h"
#include "net/protocol.h"
@@ -479,3 +481,41 @@ void LocalPlayer::setGotoTarget(Being *target)
mGoingToTarget = true;
setDestination(target->mX, target->mY);
}
+
+
+extern MiniStatusWindow *miniStatusWindow;
+
+void LocalPlayer::handleStatusEffect(StatusEffect *effect, int effectId)
+{
+ Being::handleStatusEffect(effect, effectId);
+ if (effect) {
+ effect->deliverMessage();
+
+ AnimatedSprite *sprite = effect->getIcon();
+
+ if (!sprite) {
+ // delete sprite, if necessary
+ for (unsigned int i = 0; i < mStatusEffectIcons.size();)
+ if (mStatusEffectIcons[i] == effectId) {
+ mStatusEffectIcons.erase(mStatusEffectIcons.begin() + i);
+ miniStatusWindow->eraseIcon(i);
+ } else i++;
+ } else {
+ // replace sprite or append
+ bool found = false;
+
+ for (unsigned int i = 0; i < mStatusEffectIcons.size(); i++)
+ if (mStatusEffectIcons[i] == effectId) {
+ miniStatusWindow->setIcon(i, sprite);
+ found = true;
+ break;
+ }
+
+ if (!found) { // add new
+ int offset = mStatusEffectIcons.size();
+ miniStatusWindow->setIcon(offset, sprite);
+ mStatusEffectIcons.push_back(effectId);
+ }
+ }
+ }
+}