summaryrefslogtreecommitdiff
path: root/src/net/eathena/cashshophandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-24 22:47:15 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-24 22:47:15 +0300
commit7ffba524847fa15cff8764b8274b5aedfa08bf79 (patch)
treec19f145069919583c7fca506f51e3f5727de3a88 /src/net/eathena/cashshophandler.cpp
parent7ac081450de48581d6141c90f504130c42cb5341 (diff)
downloadplus-7ffba524847fa15cff8764b8274b5aedfa08bf79.tar.gz
plus-7ffba524847fa15cff8764b8274b5aedfa08bf79.tar.bz2
plus-7ffba524847fa15cff8764b8274b5aedfa08bf79.tar.xz
plus-7ffba524847fa15cff8764b8274b5aedfa08bf79.zip
Move receive code from cashshophandler into separate file.
Diffstat (limited to 'src/net/eathena/cashshophandler.cpp')
-rw-r--r--src/net/eathena/cashshophandler.cpp94
1 files changed, 8 insertions, 86 deletions
diff --git a/src/net/eathena/cashshophandler.cpp b/src/net/eathena/cashshophandler.cpp
index 012923424..7390ae600 100644
--- a/src/net/eathena/cashshophandler.cpp
+++ b/src/net/eathena/cashshophandler.cpp
@@ -26,6 +26,7 @@
#include "gui/widgets/createwidget.h"
+#include "net/eathena/cashshoprecv.h"
#include "net/eathena/messageout.h"
#include "net/eathena/protocol.h"
@@ -36,8 +37,6 @@ extern Net::CashShopHandler *cashShopHandler;
namespace EAthena
{
-BuyDialog *CashShopHandler::mBuyDialog = nullptr;
-
CashShopHandler::CashShopHandler() :
MessageHandler()
{
@@ -53,7 +52,7 @@ CashShopHandler::CashShopHandler() :
};
handledMessages = _messages;
cashShopHandler = this;
- mBuyDialog = nullptr;
+ CashShopRecv::mBuyDialog = nullptr;
}
void CashShopHandler::handleMessage(Net::MessageIn &msg)
@@ -61,27 +60,27 @@ void CashShopHandler::handleMessage(Net::MessageIn &msg)
switch (msg.getId())
{
case SMSG_NPC_CASH_SHOP_OPEN:
- processCashShopOpen(msg);
+ CashShopRecv::processCashShopOpen(msg);
break;
case SMSG_NPC_CASH_BUY_ACK:
- processCashShopBuyAck(msg);
+ CashShopRecv::processCashShopBuyAck(msg);
break;
case SMSG_NPC_CASH_POINTS:
- processCashShopPoints(msg);
+ CashShopRecv::processCashShopPoints(msg);
break;
case SMSG_NPC_CASH_BUY:
- processCashShopBuy(msg);
+ CashShopRecv::processCashShopBuy(msg);
break;
case SMSG_NPC_CASH_TAB_PRICE_LIST:
- processCashShopTabPriceList(msg);
+ CashShopRecv::processCashShopTabPriceList(msg);
break;
case SMSG_NPC_CASH_SCHEDULE:
- processCashShopSchedule(msg);
+ CashShopRecv::processCashShopSchedule(msg);
break;
default:
@@ -89,83 +88,6 @@ void CashShopHandler::handleMessage(Net::MessageIn &msg)
}
}
-void CashShopHandler::processCashShopOpen(Net::MessageIn &msg)
-{
- const int count = (msg.readInt16("len") - 12) / 11;
-
- CREATEWIDGETV(mBuyDialog, BuyDialog, fromInt(BuyDialog::Cash, BeingId));
- mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY));
-
- msg.readInt32("cash points");
- msg.readInt32("kafra points");
- for (int f = 0; f < count; f ++)
- {
- msg.readInt32("price");
- const int value = msg.readInt32("discount price");
- const int type = msg.readUInt8("item type");
- const int itemId = msg.readInt16("item id");
- const ItemColor color = ItemColor_one;
- mBuyDialog->addItem(itemId, type, color, 0, value);
- }
- mBuyDialog->sort();
-}
-
-void CashShopHandler::processCashShopBuyAck(Net::MessageIn &msg)
-{
- UNIMPLIMENTEDPACKET;
- msg.readInt32("cash points");
- msg.readInt32("kafra points");
- msg.readInt16("error");
-}
-
-void CashShopHandler::processCashShopPoints(Net::MessageIn &msg)
-{
- UNIMPLIMENTEDPACKET;
- msg.readInt32("cash points");
- msg.readInt32("kafra points");
-}
-
-void CashShopHandler::processCashShopBuy(Net::MessageIn &msg)
-{
- UNIMPLIMENTEDPACKET;
- msg.readInt32("id");
- msg.readInt16("result");
- msg.readInt32("cash points");
- msg.readInt32("kafra points");
-}
-
-void CashShopHandler::processCashShopTabPriceList(Net::MessageIn &msg)
-{
- UNIMPLIMENTEDPACKET;
- const int count = (msg.readInt16("len") - 10) / 6;
- msg.readInt32("tab");
- const int itemsCount = msg.readInt16("count");
- if (count != itemsCount)
- logger->log("error: wrong list count");
-
- for (int f = 0; f < count; f ++)
- {
- msg.readInt16("item id");
- msg.readInt32("price");
- }
-}
-
-void CashShopHandler::processCashShopSchedule(Net::MessageIn &msg)
-{
- UNIMPLIMENTEDPACKET;
- const int count = (msg.readInt16("len") - 8) / 6;
- const int itemsCount = msg.readInt16("count");
- msg.readInt16("tab");
- if (count != itemsCount)
- logger->log("error: wrong list count");
-
- for (int f = 0; f < count; f ++)
- {
- msg.readInt16("item id");
- msg.readInt32("price");
- }
-}
-
void CashShopHandler::buyItem(const int points,
const int itemId,
const ItemColor color A_UNUSED,