diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/defines.h | 2 | ||||
-rw-r--r-- | src/game-server/being.hpp | 6 | ||||
-rw-r--r-- | src/game-server/monster.hpp | 6 | ||||
-rw-r--r-- | src/game-server/state.cpp | 1 |
4 files changed, 14 insertions, 1 deletions
diff --git a/src/defines.h b/src/defines.h index 539b72a2..4a78fa4d 100644 --- a/src/defines.h +++ b/src/defines.h @@ -160,7 +160,7 @@ enum { GPMSG_BEINGS_MOVE = 0x0280, // { W being id, B flags [, C position, B speed] [, W*2 destination] }* GPMSG_ITEMS = 0x0281, // { W item id, W*2 position }* PGMSG_ATTACK = 0x0290, // B direction - GPMSG_BEING_ATTACK = 0x0291, // W being id, B direction + GPMSG_BEING_ATTACK = 0x0291, // W being id, B direction, B attacktype PGMSG_SAY = 0x02A0, // S text GPMSG_SAY = 0x02A1, // W being id, S text GPMSG_NPC_CHOICE = 0x02B0, // W being id, { S text }* diff --git a/src/game-server/being.hpp b/src/game-server/being.hpp index 27da220a..b725bfee 100644 --- a/src/game-server/being.hpp +++ b/src/game-server/being.hpp @@ -172,6 +172,12 @@ class Being : public MovingObject { return mAction; } /** + * Gets the type of the attack the being is currently performing. + */ + virtual int getAttackType() const + { return 0; } + + /** * Moves the being toward its destination. */ void move(); diff --git a/src/game-server/monster.hpp b/src/game-server/monster.hpp index 3f6db5c1..05fedd6b 100644 --- a/src/game-server/monster.hpp +++ b/src/game-server/monster.hpp @@ -204,6 +204,12 @@ class Monster : public Being void perform(); /** + * + */ + virtual int getAttackType() + { return mCurrentAttack->id; } + + /** * Kills the being. */ void died(); diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp index 2c7a3633..21305c01 100644 --- a/src/game-server/state.cpp +++ b/src/game-server/state.cpp @@ -194,6 +194,7 @@ static void informPlayer(MapComposite *map, Character *p) MessageOut AttackMsg(GPMSG_BEING_ATTACK); AttackMsg.writeShort(oid); AttackMsg.writeByte(o->getDirection()); + AttackMsg.writeByte(static_cast< Being * >(o)->getAttackType()); gameHandler->sendTo(p, AttackMsg); } |