diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-22 19:48:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-22 19:48:04 +0300 |
commit | de4548a50ecb4d4700c9899044f50070f7d9a95a (patch) | |
tree | d54bc1bdf010b2a08cdf067fcaf64d92d42685b1 /src/net | |
parent | bf3c7384ad1b1fce8beac97f8715eb054158f72e (diff) | |
download | manaplus-de4548a50ecb4d4700c9899044f50070f7d9a95a.tar.gz manaplus-de4548a50ecb4d4700c9899044f50070f7d9a95a.tar.bz2 manaplus-de4548a50ecb4d4700c9899044f50070f7d9a95a.tar.xz manaplus-de4548a50ecb4d4700c9899044f50070f7d9a95a.zip |
Add egg selection dialog.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/ea/buysellhandler.cpp | 1 | ||||
-rw-r--r-- | src/net/eathena/pethandler.cpp | 18 |
2 files changed, 18 insertions, 1 deletions
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); } } |