summaryrefslogtreecommitdiff
path: root/src/net/eathena/markethandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/eathena/markethandler.cpp')
-rw-r--r--src/net/eathena/markethandler.cpp45
1 files changed, 4 insertions, 41 deletions
diff --git a/src/net/eathena/markethandler.cpp b/src/net/eathena/markethandler.cpp
index d0e8ff6ce..4e304b4ba 100644
--- a/src/net/eathena/markethandler.cpp
+++ b/src/net/eathena/markethandler.cpp
@@ -30,6 +30,7 @@
#include "gui/widgets/createwidget.h"
+#include "net/eathena/marketrecv.h"
#include "net/eathena/messageout.h"
#include "net/eathena/protocol.h"
@@ -40,8 +41,6 @@ extern Net::MarketHandler *marketHandler;
namespace EAthena
{
-BuyDialog *MarketHandler::mBuyDialog = nullptr;
-
MarketHandler::MarketHandler() :
MessageHandler()
{
@@ -53,7 +52,7 @@ MarketHandler::MarketHandler() :
};
handledMessages = _messages;
marketHandler = this;
- mBuyDialog = nullptr;
+ MarketRecv::mBuyDialog = nullptr;
}
void MarketHandler::handleMessage(Net::MessageIn &msg)
@@ -61,11 +60,11 @@ void MarketHandler::handleMessage(Net::MessageIn &msg)
switch (msg.getId())
{
case SMSG_NPC_MARKET_OPEN:
- processMarketOpen(msg);
+ MarketRecv::processMarketOpen(msg);
break;
case SMSG_NPC_MARKET_BUY_ACK:
- processMarketBuyAck(msg);
+ MarketRecv::processMarketBuyAck(msg);
break;
default:
@@ -73,42 +72,6 @@ void MarketHandler::handleMessage(Net::MessageIn &msg)
}
}
-void MarketHandler::processMarketOpen(Net::MessageIn &msg)
-{
- const int len = (msg.readInt16("len") - 4) / 13;
-
- CREATEWIDGETV(mBuyDialog, BuyDialog, fromInt(BuyDialog::Market, BeingId));
- mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY));
-
- for (int f = 0; f < len; f ++)
- {
- const int itemId = msg.readInt16("item id");
- const int type = msg.readUInt8("type");
- const int value = msg.readInt32("price");
- const int amount = msg.readInt32("amount");
- msg.readInt16("view");
- const ItemColor color = ItemColor_one;
- mBuyDialog->addItem(itemId, type, color, amount, value);
- }
- mBuyDialog->sort();
-}
-
-void MarketHandler::processMarketBuyAck(Net::MessageIn &msg)
-{
- const int len = (msg.readInt16("len") - 5) / 8;
- const int res = msg.readUInt8("result");
- for (int f = 0; f < len; f ++)
- {
- msg.readInt16("item id");
- msg.readInt16("amount");
- msg.readInt32("price");
- }
- if (res)
- NotifyManager::notify(NotifyTypes::BUY_DONE);
- else
- NotifyManager::notify(NotifyTypes::BUY_FAILED);
-}
-
void MarketHandler::close()
{
createOutPacket(CMSG_NPC_MARKET_CLOSE);