From de4548a50ecb4d4700c9899044f50070f7d9a95a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 22 Sep 2014 19:48:04 +0300 Subject: Add egg selection dialog. --- src/net/ea/buysellhandler.cpp | 1 + src/net/eathena/pethandler.cpp | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src/net') diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp index fe2f7ffe0..b28681cb9 100644 --- a/src/net/ea/buysellhandler.cpp +++ b/src/net/ea/buysellhandler.cpp @@ -147,6 +147,7 @@ void BuySellHandler::processNpcSell(Net::MessageIn &msg) const if (n_items > 0) { SellDialog *const dialog = new NpcSellDialog(mNpcId); + dialog->postInit(); dialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY)); for (int k = 0; k < n_items; k++) diff --git a/src/net/eathena/pethandler.cpp b/src/net/eathena/pethandler.cpp index bb513b6ac..9b2f3b22b 100644 --- a/src/net/eathena/pethandler.cpp +++ b/src/net/eathena/pethandler.cpp @@ -20,13 +20,20 @@ #include "net/eathena/pethandler.h" +#include "inventory.h" #include "notifymanager.h" +#include "being/playerinfo.h" + #include "gui/chatconsts.h" +#include "gui/windows/eggselectiondialog.h" + #include "net/chathandler.h" #include "net/net.h" +#include "net/ea/eaprotocol.h" + #include "net/eathena/menu.h" #include "net/eathena/messageout.h" #include "net/eathena/protocol.h" @@ -149,9 +156,18 @@ void PetHandler::processEggsList(Net::MessageIn &msg) { const int count = (msg.readInt16("len") - 4) / 2; menu = MenuType::Eggs; + + SellDialog *const dialog = new EggSelectionDialog; + dialog->postInit(); + Inventory *const inv = PlayerInfo::getInventory(); + for (int f = 0; f < count; f ++) { - msg.readInt16("egg index"); + const int index = msg.readInt16("index") - INVENTORY_OFFSET; + const Item *const item = inv->getItem(index); + + if (item) + dialog->addItem(item, 0); } } -- cgit v1.2.3-70-g09d2