diff options
author | Joshua Langley <joshlangley[at]optusnet.com.au> | 2007-08-14 05:59:52 +0000 |
---|---|---|
committer | Joshua Langley <joshlangley[at]optusnet.com.au> | 2007-08-14 05:59:52 +0000 |
commit | 0601642d8b3aa2c7aa365e27aa3ef2459553c3fd (patch) | |
tree | e2c4a93c3aca4b35b69857b17b722c3260b4c3d1 /src/localplayer.cpp | |
parent | 68f069fea3182c6d5720df03f1d63de38f14c31d (diff) | |
download | mana-0601642d8b3aa2c7aa365e27aa3ef2459553c3fd.tar.gz mana-0601642d8b3aa2c7aa365e27aa3ef2459553c3fd.tar.bz2 mana-0601642d8b3aa2c7aa365e27aa3ef2459553c3fd.tar.xz mana-0601642d8b3aa2c7aa365e27aa3ef2459553c3fd.zip |
mantis_id:129 - Inventory Window Slots Added.
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r-- | src/localplayer.cpp | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 478603b8..035c31f6 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -101,6 +101,17 @@ Item* LocalPlayer::getInvItem(int index) return mInventory->getItem(index); } +void +LocalPlayer::moveInvItem(Item *item, int newIndex) +{ + // special case, the old and new cannot copy over each other. + if (item->getInvIndex() == newIndex) + return; + + Net::GameServer::Player::moveItem( + item->getInvIndex(), newIndex, item->getQuantity()); +} + void LocalPlayer::equipItem(Item *item) { Net::GameServer::Player::equip(item->getInvIndex()); @@ -114,15 +125,9 @@ void LocalPlayer::unequipItem(int slot) mEquipment->setEquipment(slot, 0); } -void LocalPlayer::useItem(Item *item) +void LocalPlayer::useItem(int slot) { - // XXX Convert for new server - /* - MessageOut outMsg(CMSG_PLAYER_INVENTORY_USE); - outMsg.writeShort(item->getInvIndex()); - outMsg.writeLong(item->getId()); - // Note: id is dest of item, usually player_node->account_ID ?? - */ + Net::GameServer::Player::useItem(slot); } void LocalPlayer::dropItem(Item *item, int quantity) @@ -130,6 +135,17 @@ void LocalPlayer::dropItem(Item *item, int quantity) Net::GameServer::Player::drop(item->getInvIndex(), quantity); } +void LocalPlayer::splitItem(Item *item, int quantity) +{ + int newIndex = mInventory->getFreeSlot(); + if (newIndex > Inventory::NO_SLOT_INDEX) + { + Net::GameServer::Player::moveItem( + item->getInvIndex(), newIndex, quantity); + } + +} + void LocalPlayer::pickUp(FloorItem *item) { int dx = item->getX() - mX / 32; |