summaryrefslogtreecommitdiff
path: root/src/net/eathena/pethandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-17 20:23:35 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-17 20:23:35 +0300
commit97240b75d2bdd19a0d98b52d978938be9d984478 (patch)
treebdb13fbfb8e7088fc0298470b951530e0cffc8bb /src/net/eathena/pethandler.cpp
parente5ca9fbefd9a680b958a957f0fe01f93293bcd39 (diff)
downloadmv-97240b75d2bdd19a0d98b52d978938be9d984478.tar.gz
mv-97240b75d2bdd19a0d98b52d978938be9d984478.tar.bz2
mv-97240b75d2bdd19a0d98b52d978938be9d984478.tar.xz
mv-97240b75d2bdd19a0d98b52d978938be9d984478.zip
On using eggs, if present only one egg in invenory, auto hatch it.
Diffstat (limited to 'src/net/eathena/pethandler.cpp')
-rw-r--r--src/net/eathena/pethandler.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/net/eathena/pethandler.cpp b/src/net/eathena/pethandler.cpp
index f04d1e8fc..41b69550c 100644
--- a/src/net/eathena/pethandler.cpp
+++ b/src/net/eathena/pethandler.cpp
@@ -35,6 +35,7 @@
#include "gui/widgets/tabs/chat/chattab.h"
#include "net/chathandler.h"
+#include "net/inventoryhandler.h"
#include "net/ea/eaprotocol.h"
@@ -195,11 +196,18 @@ void PetHandler::processPetRoulette(Net::MessageIn &msg)
void PetHandler::processEggsList(Net::MessageIn &msg)
{
const int count = (msg.readInt16("len") - 4) / 2;
+ Inventory *const inv = PlayerInfo::getInventory();
menu = MenuType::Eggs;
+ if (count == 1)
+ {
+ const int index = msg.readInt16("index") - INVENTORY_OFFSET;
+ const Item *const item = inv->getItem(index);
+ inventoryHandler->selectEgg(item);
+ return;
+ }
SellDialog *const dialog = new EggSelectionDialog;
dialog->postInit();
- Inventory *const inv = PlayerInfo::getInventory();
for (int f = 0; f < count; f ++)
{