summaryrefslogtreecommitdiff
path: root/src/net/tmwserv
diff options
context:
space:
mode:
authorPhilipp Sehmisch <crush@themanaworld.org>2009-09-27 17:18:01 +0200
committerPhilipp Sehmisch <crush@themanaworld.org>2009-09-27 17:18:01 +0200
commit2c1745f6a0fc3642a986aff5f3e23a79ee96450e (patch)
tree9c80000fcab35962d4579f074c30da7cfc2244a0 /src/net/tmwserv
parent658c737c051fc28fa1d33e6ac0d07a36e9d5f8e0 (diff)
downloadmana-client-2c1745f6a0fc3642a986aff5f3e23a79ee96450e.tar.gz
mana-client-2c1745f6a0fc3642a986aff5f3e23a79ee96450e.tar.bz2
mana-client-2c1745f6a0fc3642a986aff5f3e23a79ee96450e.tar.xz
mana-client-2c1745f6a0fc3642a986aff5f3e23a79ee96450e.zip
Client-sided netcode support for being-bound special effects
Diffstat (limited to 'src/net/tmwserv')
-rw-r--r--src/net/tmwserv/effecthandler.cpp27
-rw-r--r--src/net/tmwserv/effecthandler.h3
-rw-r--r--src/net/tmwserv/protocol.h3
3 files changed, 27 insertions, 6 deletions
diff --git a/src/net/tmwserv/effecthandler.cpp b/src/net/tmwserv/effecthandler.cpp
index 34da9c7d..a9960936 100644
--- a/src/net/tmwserv/effecthandler.cpp
+++ b/src/net/tmwserv/effecthandler.cpp
@@ -25,14 +25,17 @@
#include "net/messagein.h"
+#include "beingmanager.h"
#include "effectmanager.h"
+#include "log.h"
namespace TmwServ {
EffectHandler::EffectHandler()
{
static const Uint16 _messages[] = {
- GPMSG_CREATE_EFFECT,
+ GPMSG_CREATE_EFFECT_POS,
+ GPMSG_CREATE_EFFECT_BEING,
0
};
handledMessages = _messages;
@@ -42,15 +45,18 @@ void EffectHandler::handleMessage(MessageIn &msg)
{
switch (msg.getId())
{
- case GPMSG_CREATE_EFFECT:
- handleCreateEffects(msg);
+ case GPMSG_CREATE_EFFECT_POS:
+ handleCreateEffectPos(msg);
+ break;
+ case GPMSG_CREATE_EFFECT_BEING:
+ handleCreateEffectBeing(msg);
break;
default:
break;
}
}
-void EffectHandler::handleCreateEffects(MessageIn &msg)
+void EffectHandler::handleCreateEffectPos(MessageIn &msg)
{
int id = msg.readInt16();
Uint16 x = msg.readInt16();
@@ -58,4 +64,17 @@ void EffectHandler::handleCreateEffects(MessageIn &msg)
effectManager->trigger(id, x, y);
}
+void EffectHandler::handleCreateEffectBeing(MessageIn &msg)
+{
+ int eid = msg.readInt16();
+ int bid = msg.readInt16();
+ Being* b = beingManager->findBeing(bid);
+ if (b)
+ {
+ effectManager->trigger(eid, b);
+ } else {
+ logger->log("Warning: CreateEffect called for unknown being #%d", bid);
+ }
+}
+
} // namespace TmwServ
diff --git a/src/net/tmwserv/effecthandler.h b/src/net/tmwserv/effecthandler.h
index 05638cad..b15b9b0a 100644
--- a/src/net/tmwserv/effecthandler.h
+++ b/src/net/tmwserv/effecthandler.h
@@ -34,7 +34,8 @@ class EffectHandler : public MessageHandler
void handleMessage(MessageIn &msg);
private:
- void handleCreateEffects(MessageIn &msg);
+ void handleCreateEffectPos(MessageIn &msg);
+ void handleCreateEffectBeing(MessageIn &msg);
};
} // namespace TmwServ
diff --git a/src/net/tmwserv/protocol.h b/src/net/tmwserv/protocol.h
index 60a50d89..1a42093e 100644
--- a/src/net/tmwserv/protocol.h
+++ b/src/net/tmwserv/protocol.h
@@ -147,7 +147,8 @@ enum {
PGMSG_USE_ITEM = 0x0300, // B slot
GPMSG_USE_RESPONSE = 0x0301, // B error
GPMSG_BEINGS_DAMAGE = 0x0310, // { W being id, W amount }*
- GPMSG_CREATE_EFFECT = 0x0320, // W effect id, W*2 position
+ GPMSG_CREATE_EFFECT_POS = 0x0320, // W effect id, W*2 position
+ GPMSG_CREATE_EFFECT_BEING = 0x0321, // W effect id, W BeingID
// Guild
PCMSG_GUILD_CREATE = 0x0350, // S name