diff options
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/tmwserv/effecthandler.cpp | 27 | ||||
-rw-r--r-- | src/net/tmwserv/effecthandler.h | 3 | ||||
-rw-r--r-- | src/net/tmwserv/protocol.h | 3 |
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 |