diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-07-13 19:52:12 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-07-13 19:52:12 -0600 |
commit | 666211542df4fd4fb0f9a1c936b54f6405ef09ba (patch) | |
tree | 478ea55ae467406f2f90f8941a2c5bc2a74a48db /src/net | |
parent | 6c764b3c95d0c078c5ccebac607517353e64dc55 (diff) | |
download | mana-client-666211542df4fd4fb0f9a1c936b54f6405ef09ba.tar.gz mana-client-666211542df4fd4fb0f9a1c936b54f6405ef09ba.tar.bz2 mana-client-666211542df4fd4fb0f9a1c936b54f6405ef09ba.tar.xz mana-client-666211542df4fd4fb0f9a1c936b54f6405ef09ba.zip |
Some item pickup cleaning
Still need to find where to attach LocalPlayer::pickedUp for TMWServ.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/ea/inventoryhandler.cpp | 39 | ||||
-rw-r--r-- | src/net/tmwserv/gameserver/player.cpp | 8 | ||||
-rw-r--r-- | src/net/tmwserv/gameserver/player.h | 1 | ||||
-rw-r--r-- | src/net/tmwserv/playerhandler.cpp | 5 |
4 files changed, 15 insertions, 38 deletions
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index c1f04661..ebea1883 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -178,42 +178,25 @@ void InventoryHandler::handleMessage(MessageIn &msg) equipType = msg.readInt16(); itemType = msg.readInt8(); - if (msg.readInt8() > 0) - { - if (config.getValue("showpickupchat", 1)) - { - localChatTab->chatLog(_("Unable to pick up item."), - BY_SERVER); - } - } - else { const ItemInfo &itemInfo = ItemDB::get(itemId); - const std::string amountStr = - // TRANSLATORS: Used as in "You picked up a ...", when - // picking up only one item. - (amount > 1) ? toString(amount) : _("a"); - if (config.getValue("showpickupchat", 1)) + if (msg.readInt8() > 0) { - localChatTab->chatLog(strprintf(_("You picked up %s [@@%d|%s@@]."), - amountStr.c_str(), itemInfo.getId(), itemInfo.getName().c_str()), - BY_SERVER); + player_node->pickedUp(itemInfo, 0); } - - if (config.getValue("showpickupparticle", 0)) + else { - player_node->pickedUp(itemInfo.getName()); - } + player_node->pickedUp(itemInfo, amount); - if (Item *item = inventory->getItem(index)) { - item->setId(itemId); - item->increaseQuantity(amount); - } else { - inventory->setItem(index, itemId, amount, equipType != 0); + if (Item *item = inventory->getItem(index)) { + item->setId(itemId); + item->increaseQuantity(amount); + } else { + inventory->setItem(index, itemId, amount, equipType != 0); + } } - } - break; + } break; case SMSG_PLAYER_INVENTORY_REMOVE: index = msg.readInt16() - INVENTORY_OFFSET; diff --git a/src/net/tmwserv/gameserver/player.cpp b/src/net/tmwserv/gameserver/player.cpp index 93853681..733b7cdc 100644 --- a/src/net/tmwserv/gameserver/player.cpp +++ b/src/net/tmwserv/gameserver/player.cpp @@ -41,14 +41,6 @@ void Net::GameServer::Player::walk(int x, int y) Net::GameServer::connection->send(msg); } -void Net::GameServer::Player::pickUp(int x, int y) -{ - MessageOut msg(PGMSG_PICKUP); - msg.writeInt16(x); - msg.writeInt16(y); - Net::GameServer::connection->send(msg); -} - void Net::GameServer::Player::moveItem(int oldSlot, int newSlot, int amount) { MessageOut msg(PGMSG_MOVE_ITEM); diff --git a/src/net/tmwserv/gameserver/player.h b/src/net/tmwserv/gameserver/player.h index 24b25dc7..76d7844b 100644 --- a/src/net/tmwserv/gameserver/player.h +++ b/src/net/tmwserv/gameserver/player.h @@ -41,7 +41,6 @@ namespace Net namespace Player { void walk(int x, int y); - void pickUp(int x, int y); void moveItem(int oldSlot, int newSlot, int amount); void useSpecial(int special); void requestTrade(int id); diff --git a/src/net/tmwserv/playerhandler.cpp b/src/net/tmwserv/playerhandler.cpp index 825da8a4..6cf81496 100644 --- a/src/net/tmwserv/playerhandler.cpp +++ b/src/net/tmwserv/playerhandler.cpp @@ -335,7 +335,10 @@ void PlayerHandler::decreaseStat(LocalPlayer::Attribute attr) void PlayerHandler::pickUp(FloorItem *floorItem) { int id = floorItem->getId(); - Net::GameServer::Player::pickUp(id >> 16, id & 0xFFFF); + MessageOut msg(PGMSG_PICKUP); + msg.writeInt16(id >> 16); + msg.writeInt16(id & 0xFFFF); + Net::GameServer::connection->send(msg); } void PlayerHandler::setDirection(char direction) |