From 97240b75d2bdd19a0d98b52d978938be9d984478 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 17 Dec 2014 20:23:35 +0300 Subject: On using eggs, if present only one egg in invenory, auto hatch it. --- src/net/eathena/pethandler.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/net/eathena/pethandler.cpp') 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 ++) { -- cgit v1.2.3-70-g09d2