From a03aa92149bbabd6aa23c88ee337d04cefbf50c0 Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Wed, 3 Jan 2007 23:18:45 +0000 Subject: Added message for new items. --- src/defines.h | 1 + src/game-server/state.cpp | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/defines.h b/src/defines.h index b6479d2c..940f9322 100644 --- a/src/defines.h +++ b/src/defines.h @@ -142,6 +142,7 @@ enum { // player: S name, B hair style, B hair color, B gender // monster: W type id GPMSG_BEING_LEAVE = 0x0201, // W being id + GPMSG_ITEM_APPEAR = 0x0202, // W item id, W*2 position PGMSG_WALK = 0x0260, // W*2 destination GPMSG_BEINGS_MOVE = 0x0280, // { W being id, B flags [, C position] [, W*2 destination] }* GPMSG_ITEMS = 0x0281, // { W item id, W*2 position }* diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp index 90243742..2972bd06 100644 --- a/src/game-server/state.cpp +++ b/src/game-server/state.cpp @@ -216,9 +216,20 @@ void State::informPlayer(MapComposite *map, Player *p) if (willBeInRange ^ wereInRange) { - itemMsg.writeShort(willBeInRange ? o->getItemClass()->getDatabaseID() : 0); - itemMsg.writeShort(opos.x); - itemMsg.writeShort(opos.y); + if (oflags & NEW_ON_MAP) + { + MessageOut appearMsg(GPMSG_ITEM_APPEAR); + appearMsg.writeShort(o->getItemClass()->getDatabaseID()); + appearMsg.writeShort(opos.x); + appearMsg.writeShort(opos.y); + gameHandler->sendTo(p, appearMsg); + } + else + { + itemMsg.writeShort(willBeInRange ? o->getItemClass()->getDatabaseID() : 0); + itemMsg.writeShort(opos.x); + itemMsg.writeShort(opos.y); + } } } -- cgit v1.2.3-70-g09d2