summaryrefslogtreecommitdiff
path: root/src/net/beinghandler.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-08-28 18:32:11 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-08-28 18:32:11 +0000
commit566a6fb8d0fc35267b43721f7e1802ba3475af3d (patch)
treef5d3e09bda9e8e66be885b581f28cad4130ca645 /src/net/beinghandler.cpp
parentb506fe0ff8a2039167aa7c349087af4dd03e1921 (diff)
downloadMana-566a6fb8d0fc35267b43721f7e1802ba3475af3d.tar.gz
Mana-566a6fb8d0fc35267b43721f7e1802ba3475af3d.tar.bz2
Mana-566a6fb8d0fc35267b43721f7e1802ba3475af3d.tar.xz
Mana-566a6fb8d0fc35267b43721f7e1802ba3475af3d.zip
Added support for being effects through the eAthena levelup message, and check
whether the being exists before referencing it. Re-enabled proper MP bar display. Improved handling of a warp to the same map.
Diffstat (limited to 'src/net/beinghandler.cpp')
-rw-r--r--src/net/beinghandler.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index c43c674f..7a0be952 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -36,7 +36,9 @@
#include "../main.h"
#include "../particle.h"
#include "../sound.h"
+#include <iostream>
#include "../player_relations.h"
+#include "../npc.h"
const int EMOTION_TIME = 150; /**< Duration of emotion icon */
@@ -49,7 +51,7 @@ BeingHandler::BeingHandler(bool enableSync):
SMSG_BEING_MOVE2,
SMSG_BEING_REMOVE,
SMSG_BEING_ACTION,
- SMSG_BEING_LEVELUP,
+ SMSG_BEING_SELFEFFECT,
SMSG_BEING_EMOTION,
SMSG_BEING_CHANGE_LOOKS,
SMSG_BEING_CHANGE_LOOKS2,
@@ -208,6 +210,9 @@ void BeingHandler::handleMessage(MessageIn *msg)
player_node->stopAttack();
}
+ if (dstBeing == current_npc)
+ current_npc = NULL;
+
if (msg->readInt8() == 1)
{
dstBeing->setAction(Being::DEAD);
@@ -258,27 +263,17 @@ void BeingHandler::handleMessage(MessageIn *msg)
}
break;
- case SMSG_BEING_LEVELUP:
+ case SMSG_BEING_SELFEFFECT: {
id = (Uint32)msg->readInt32();
+ if (!beingManager->findBeing(id))
+ break;
+
+ int effectType = msg->readInt32();
+
+ beingManager->findBeing(id)->triggerEffect(effectType);
- if (id == player_node->getId()) {
- logger->log("Level up");
- sound.playSfx("sfx/levelup.ogg");
- }
- else {
- logger->log("Someone else went level up");
- }
- Particle *levelupFX;
- if (msg->readInt32() == 0) { // type
- levelupFX = particleEngine->addEffect(
- "graphics/particles/levelup.particle.xml", 0, 0);
- }
- else {
- levelupFX = particleEngine->addEffect(
- "graphics/particles/skillup.particle.xml", 0, 0);
- }
- beingManager->findBeing(id)->controlParticle(levelupFX);
break;
+ }
case SMSG_BEING_EMOTION:
if (!(dstBeing = beingManager->findBeing(msg->readInt32())))
@@ -513,3 +508,4 @@ void BeingHandler::handleMessage(MessageIn *msg)
break;
}
}
+