From c76cb084b9c995fba9a19fbdb5f23d479f67a115 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 30 Jan 2017 19:34:16 +0300 Subject: Move BuySellRecv::processNpcBuyResponse from ea namespace into eathena and tmwa. In eathena version remove access to buy dialog, because anyway it must not exists at this time. --- src/net/eathena/buysellrecv.cpp | 28 ++++++++++++++++++++++++++++ src/net/eathena/buysellrecv.h | 1 + src/net/eathena/packetsin.inc | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) (limited to 'src/net/eathena') diff --git a/src/net/eathena/buysellrecv.cpp b/src/net/eathena/buysellrecv.cpp index 0a96ef0df..f817813c6 100644 --- a/src/net/eathena/buysellrecv.cpp +++ b/src/net/eathena/buysellrecv.cpp @@ -84,4 +84,32 @@ void BuySellRecv::processNpcSellResponse(Net::MessageIn &msg) } } +void BuySellRecv::processNpcBuyResponse(Net::MessageIn &msg) +{ + const uint8_t response = msg.readUInt8("response"); + if (response == 0U) + { + NotifyManager::notify(NotifyTypes::BUY_DONE); + return; + } + switch (response) + { + case 1: + NotifyManager::notify(NotifyTypes::BUY_FAILED_NO_MONEY); + break; + + case 2: + NotifyManager::notify(NotifyTypes::BUY_FAILED_OVERWEIGHT); + break; + + case 3: + NotifyManager::notify(NotifyTypes::BUY_FAILED_TOO_MANY_ITEMS); + break; + + default: + NotifyManager::notify(NotifyTypes::BUY_FAILED); + break; + }; +} + } // namespace EAthena diff --git a/src/net/eathena/buysellrecv.h b/src/net/eathena/buysellrecv.h index 56cacd14f..f3158948e 100644 --- a/src/net/eathena/buysellrecv.h +++ b/src/net/eathena/buysellrecv.h @@ -34,6 +34,7 @@ namespace EAthena { void processNpcBuy(Net::MessageIn &msg); void processNpcSellResponse(Net::MessageIn &msg); + void processNpcBuyResponse(Net::MessageIn &msg); } // namespace BuySellRecv } // namespace EAthena diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc index 97278eda4..bc0bcf9a6 100644 --- a/src/net/eathena/packetsin.inc +++ b/src/net/eathena/packetsin.inc @@ -190,7 +190,7 @@ packet(SMSG_MVP_EXP, 0x010b, 6, &ChatRecv::processMVPExp packet(SMSG_MVP_EFFECT, 0x010c, 6, &Ea::ChatRecv::processMVPEffect, 0); packet(SMSG_MVP_NO_ITEM, 0x010d, 2, &ChatRecv::processMVPNoItem, 0); packet(SMSG_NPC_BUY, 0x00c6, -1, &BuySellRecv::processNpcBuy, 0); -packet(SMSG_NPC_BUY_RESPONSE, 0x00ca, 3, &Ea::BuySellRecv::processNpcBuyResponse, 0); +packet(SMSG_NPC_BUY_RESPONSE, 0x00ca, 3, &BuySellRecv::processNpcBuyResponse, 0); packet(SMSG_NPC_BUY_SELL_CHOICE, 0x00c4, 6, &Ea::BuySellRecv::processNpcBuySellChoice, 0); packet(SMSG_NPC_CASH_BUY, 0x0849, 16, &CashShopRecv::processCashShopBuy, 0); packet(SMSG_NPC_CASH_POINTS, 0x0845, 10, &CashShopRecv::processCashShopPoints, 0); -- cgit v1.2.3-70-g09d2