summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-01-30 19:34:16 +0300
committerAndrei Karas <akaras@inbox.ru>2017-01-30 20:39:49 +0300
commitc76cb084b9c995fba9a19fbdb5f23d479f67a115 (patch)
treea1b493adb2f7a21bbabb5b0178733f9082b3983c /src/net
parent5f8496ca103fabb4cfc265d8d936e194129a17ef (diff)
downloadmv-c76cb084b9c995fba9a19fbdb5f23d479f67a115.tar.gz
mv-c76cb084b9c995fba9a19fbdb5f23d479f67a115.tar.bz2
mv-c76cb084b9c995fba9a19fbdb5f23d479f67a115.tar.xz
mv-c76cb084b9c995fba9a19fbdb5f23d479f67a115.zip
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.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/buysellrecv.cpp35
-rw-r--r--src/net/ea/buysellrecv.h1
-rw-r--r--src/net/eathena/buysellrecv.cpp28
-rw-r--r--src/net/eathena/buysellrecv.h1
-rw-r--r--src/net/eathena/packetsin.inc2
-rw-r--r--src/net/tmwa/buysellrecv.cpp35
-rw-r--r--src/net/tmwa/buysellrecv.h1
-rw-r--r--src/net/tmwa/packetsin.inc2
8 files changed, 67 insertions, 38 deletions
diff --git a/src/net/ea/buysellrecv.cpp b/src/net/ea/buysellrecv.cpp
index 9ecaa5bbc..359e08038 100644
--- a/src/net/ea/buysellrecv.cpp
+++ b/src/net/ea/buysellrecv.cpp
@@ -90,39 +90,4 @@ void BuySellRecv::processNpcSell(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;
- }
- // Reset player money since buy dialog already assumed purchase
- // would go fine
- if (Ea::BuySellRecv::mBuyDialog)
- {
- Ea::BuySellRecv::mBuyDialog->setMoney(
- PlayerInfo::getAttribute(Attributes::MONEY));
- }
- 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 Ea
diff --git a/src/net/ea/buysellrecv.h b/src/net/ea/buysellrecv.h
index f00be68e8..6f32c7dc4 100644
--- a/src/net/ea/buysellrecv.h
+++ b/src/net/ea/buysellrecv.h
@@ -41,7 +41,6 @@ namespace Ea
void processNpcBuySellChoice(Net::MessageIn &msg);
void processNpcSell(Net::MessageIn &msg);
- void processNpcBuyResponse(Net::MessageIn &msg);
} // namespace BuySellRecv
} // namespace Ea
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);
diff --git a/src/net/tmwa/buysellrecv.cpp b/src/net/tmwa/buysellrecv.cpp
index 230327899..6a30f7bc6 100644
--- a/src/net/tmwa/buysellrecv.cpp
+++ b/src/net/tmwa/buysellrecv.cpp
@@ -82,4 +82,39 @@ 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;
+ }
+ // Reset player money since buy dialog already assumed purchase
+ // would go fine
+ if (Ea::BuySellRecv::mBuyDialog)
+ {
+ Ea::BuySellRecv::mBuyDialog->setMoney(
+ PlayerInfo::getAttribute(Attributes::MONEY));
+ }
+ 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 TmwAthena
diff --git a/src/net/tmwa/buysellrecv.h b/src/net/tmwa/buysellrecv.h
index b5bd82ace..36607df84 100644
--- a/src/net/tmwa/buysellrecv.h
+++ b/src/net/tmwa/buysellrecv.h
@@ -34,6 +34,7 @@ namespace TmwAthena
{
void processNpcBuy(Net::MessageIn &msg);
void processNpcSellResponse(Net::MessageIn &msg);
+ void processNpcBuyResponse(Net::MessageIn &msg);
} // namespace BuySellRecv
} // namespace TmwAthena
diff --git a/src/net/tmwa/packetsin.inc b/src/net/tmwa/packetsin.inc
index 2ee65afd9..150028a41 100644
--- a/src/net/tmwa/packetsin.inc
+++ b/src/net/tmwa/packetsin.inc
@@ -62,7 +62,7 @@ packet(SMSG_MAP_MUSIC, 0x0227, -1, &Ea::PlayerRecv::process
packet(SMSG_MAP_QUIT_RESPONSE, 0x018b, 4, &Ea::GameRecv::processMapQuitResponse, 0);
packet(SMSG_MVP_EFFECT, 0x010c, 6, &Ea::ChatRecv::processMVPEffect, 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_CHANGETITLE, 0x0228, -1, &Ea::NpcRecv::processChangeTitle, 0);
packet(SMSG_NPC_CHOICE, 0x00b7, -1, &Ea::NpcRecv::processNpcChoice, 0);