summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-01-25 22:01:11 +0300
committerAndrei Karas <akaras@inbox.ru>2019-01-25 22:01:11 +0300
commit4a879f52c53c4fb9542319bc1f5864998a1fbb22 (patch)
tree56818bb356a7791a41d2321664c0607c669a767b /src/net
parent69497b251263eb590d75326effa9fe7206c49ba0 (diff)
downloadManaVerse-4a879f52c53c4fb9542319bc1f5864998a1fbb22.tar.gz
ManaVerse-4a879f52c53c4fb9542319bc1f5864998a1fbb22.tar.bz2
ManaVerse-4a879f52c53c4fb9542319bc1f5864998a1fbb22.tar.xz
ManaVerse-4a879f52c53c4fb9542319bc1f5864998a1fbb22.zip
Add packet CMSG_NPC_BARTER_CLOSE 0x0b12
Diffstat (limited to 'src/net')
-rw-r--r--src/net/barterhandler.h49
-rw-r--r--src/net/eathena/barterhandler.cpp60
-rw-r--r--src/net/eathena/barterhandler.h43
-rw-r--r--src/net/eathena/barterrecv.cpp40
-rw-r--r--src/net/eathena/barterrecv.h39
-rw-r--r--src/net/eathena/generalhandler.cpp3
-rw-r--r--src/net/eathena/generalhandler.h2
-rw-r--r--src/net/eathena/packetsout.inc21
-rw-r--r--src/net/net.cpp2
-rw-r--r--src/net/tmwa/barterhandler.cpp43
-rw-r--r--src/net/tmwa/barterhandler.h42
-rw-r--r--src/net/tmwa/generalhandler.cpp3
-rw-r--r--src/net/tmwa/generalhandler.h2
13 files changed, 348 insertions, 1 deletions
diff --git a/src/net/barterhandler.h b/src/net/barterhandler.h
new file mode 100644
index 000000000..d15e68377
--- /dev/null
+++ b/src/net/barterhandler.h
@@ -0,0 +1,49 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2019 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NET_BARTERHANDLER_H
+#define NET_BARTERHANDLER_H
+
+#include "localconsts.h"
+
+class ShopItem;
+
+namespace Net
+{
+
+class BarterHandler notfinal
+{
+ public:
+ BarterHandler()
+ { }
+
+ A_DELETE_COPY(BarterHandler)
+
+ virtual ~BarterHandler()
+ { }
+
+ virtual void close() const = 0;
+};
+
+} // namespace Net
+
+extern Net::BarterHandler *barterHandler;
+
+#endif // NET_BARTERHANDLER_H
diff --git a/src/net/eathena/barterhandler.cpp b/src/net/eathena/barterhandler.cpp
new file mode 100644
index 000000000..7ce0c959f
--- /dev/null
+++ b/src/net/eathena/barterhandler.cpp
@@ -0,0 +1,60 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2019 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "net/eathena/barterhandler.h"
+
+#include "net/eathena/barterrecv.h"
+#include "net/eathena/messageout.h"
+#include "net/eathena/protocolout.h"
+
+#include "debug.h"
+
+extern int packetVersionMain;
+extern int packetVersionRe;
+extern int packetVersionZero;
+
+namespace EAthena
+{
+
+BarterHandler::BarterHandler() :
+ Net::BarterHandler()
+{
+ barterHandler = this;
+ BarterRecv::mBuyDialog = nullptr;
+}
+
+BarterHandler::~BarterHandler()
+{
+ barterHandler = nullptr;
+}
+
+void BarterHandler::close() const
+{
+ if (packetVersionMain < 20190116 &&
+ packetVersionRe < 20190116 &&
+ packetVersionZero < 20181226)
+ {
+ return;
+ }
+
+ createOutPacket(CMSG_NPC_BARTER_CLOSE);
+}
+
+} // namespace EAthena
diff --git a/src/net/eathena/barterhandler.h b/src/net/eathena/barterhandler.h
new file mode 100644
index 000000000..5ee29101a
--- /dev/null
+++ b/src/net/eathena/barterhandler.h
@@ -0,0 +1,43 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2019 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NET_EATHENA_BARTERHANDLER_H
+#define NET_EATHENA_BARTERHANDLER_H
+
+#include "net/barterhandler.h"
+
+namespace EAthena
+{
+
+class BarterHandler final : public Net::BarterHandler
+{
+ public:
+ BarterHandler();
+
+ A_DELETE_COPY(BarterHandler)
+
+ ~BarterHandler() override final;
+
+ void close() const override final;
+};
+
+} // namespace EAthena
+
+#endif // NET_EATHENA_BARTERHANDLER_H
diff --git a/src/net/eathena/barterrecv.cpp b/src/net/eathena/barterrecv.cpp
new file mode 100644
index 000000000..b1b46f528
--- /dev/null
+++ b/src/net/eathena/barterrecv.cpp
@@ -0,0 +1,40 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2019 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "net/eathena/barterrecv.h"
+
+#include "gui/windows/buydialog.h"
+
+#include "net/messagein.h"
+
+#include "debug.h"
+
+extern int itemIdLen;
+
+namespace EAthena
+{
+
+namespace BarterRecv
+{
+ BuyDialog *mBuyDialog = nullptr;
+} // namespace BarterRecv
+
+
+} // namespace EAthena
diff --git a/src/net/eathena/barterrecv.h b/src/net/eathena/barterrecv.h
new file mode 100644
index 000000000..0de70be5f
--- /dev/null
+++ b/src/net/eathena/barterrecv.h
@@ -0,0 +1,39 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2019 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NET_EATHENA_BARTERRECV_H
+#define NET_EATHENA_BARTERRECV_H
+
+namespace Net
+{
+ class MessageIn;
+} // namespace Net
+
+class BuyDialog;
+
+namespace EAthena
+{
+ namespace BarterRecv
+ {
+ extern BuyDialog *mBuyDialog;
+ } // namespace BarterRecv
+} // namespace EAthena
+
+#endif // NET_EATHENA_BARTERRECV_H
diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp
index 4eca2f2a7..ff420092d 100644
--- a/src/net/eathena/generalhandler.cpp
+++ b/src/net/eathena/generalhandler.cpp
@@ -37,6 +37,7 @@
#include "net/eathena/achievementhandler.h"
#include "net/eathena/attendancehandler.h"
#include "net/eathena/bankhandler.h"
+#include "net/eathena/barterhandler.h"
#include "net/eathena/battlegroundhandler.h"
#include "net/eathena/beinghandler.h"
#include "net/eathena/buyingstorehandler.h"
@@ -116,6 +117,7 @@ GeneralHandler::GeneralHandler() :
mElementalHandler(new ElementalHandler),
mMapHandler(new MapHandler),
mMarketHandler(new MarketHandler),
+ mBarterHandler(new BarterHandler),
mVendingHandler(new VendingHandler),
mRouletteHandler(new RouletteHandler),
mSearchStoreHandler(new SearchStoreHandler)
@@ -163,6 +165,7 @@ GeneralHandler::~GeneralHandler()
delete2(mElementalHandler)
delete2(mMapHandler)
delete2(mMarketHandler)
+ delete2(mBarterHandler)
delete2(mVendingHandler)
delete2(mRouletteHandler)
delete2(mSearchStoreHandler)
diff --git a/src/net/eathena/generalhandler.h b/src/net/eathena/generalhandler.h
index a7269d50d..509b01fcb 100644
--- a/src/net/eathena/generalhandler.h
+++ b/src/net/eathena/generalhandler.h
@@ -29,6 +29,7 @@ namespace EAthena
{
class AdminHandler;
+class BarterHandler;
class BeingHandler;
class BuySellHandler;
class CharServerHandler;
@@ -130,6 +131,7 @@ class GeneralHandler final : public Net::GeneralHandler
ElementalHandler *mElementalHandler;
MapHandler *mMapHandler;
MarketHandler *mMarketHandler;
+ BarterHandler *mBarterHandler;
VendingHandler *mVendingHandler;
RouletteHandler *mRouletteHandler;
SearchStoreHandler *mSearchStoreHandler;
diff --git a/src/net/eathena/packetsout.inc b/src/net/eathena/packetsout.inc
index 75baa0dc4..aca3e0b8f 100644
--- a/src/net/eathena/packetsout.inc
+++ b/src/net/eathena/packetsout.inc
@@ -351,6 +351,7 @@ packet(CMSG_INVENTORY_EXPAND_CONFIRM, 0x0000, 0, nullptr);
packet(CMSG_INVENTORY_EXPAND_REJECT, 0x0000, 0, nullptr);
packet(CMSG_SKILL_USE_BEING_START, 0x0000, 0, nullptr);
packet(CMSG_SKILL_USE_BEING_STOP, 0x0000, 0, nullptr);
+packet(CMSG_NPC_BARTER_CLOSE, 0x0000, 0, nullptr);
#else
// 20040713
if (packetVersion >= 20040713)
@@ -1531,10 +1532,28 @@ if (packetVersionZero >= 20181114)
packet(CMSG_NPC_SELECT_ARROW, 0x01ae, 6, clif->pSelectArrow);
}
-// 20181121
+// 20181121 main
if (packetVersionMain >= 20181121)
{
packet(CMSG_NPC_SELECT_ARROW, 0x01ae, 6, clif->pSelectArrow);
}
+// 20181226 zero
+if (packetVersionZero >= 20181226)
+{
+ packet(CMSG_NPC_BARTER_CLOSE, 0x0b12, 2, clif->pNPCBarterClosed);
+}
+
+// 20190116 main
+if (packetVersionMain >= 20190116)
+{
+ packet(CMSG_NPC_BARTER_CLOSE, 0x0b12, 2, clif->pNPCBarterClosed);
+}
+
+// 20190116 re
+if (packetVersionRe >= 20190116)
+{
+ packet(CMSG_NPC_BARTER_CLOSE, 0x0b12, 2, clif->pNPCBarterClosed);
+}
+
#endif
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 2512ecacb..03f59c2b8 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -44,6 +44,7 @@ namespace Net
class AchievementHandler;
class AttendanceHandler;
class BankHandler;
+ class BarterHandler;
class BattleGroundHandler;
class BuyingStoreHandler;
class CashShopHandler;
@@ -111,6 +112,7 @@ Net::Mail2Handler *mail2Handler = nullptr;
Net::MailHandler *mailHandler = nullptr;
Net::MapHandler *mapHandler = nullptr;
Net::MarketHandler *marketHandler = nullptr;
+Net::BarterHandler *barterHandler = nullptr;
Net::MercenaryHandler *mercenaryHandler = nullptr;
Net::RouletteHandler *rouletteHandler = nullptr;
Net::SearchStoreHandler *searchStoreHandler = nullptr;
diff --git a/src/net/tmwa/barterhandler.cpp b/src/net/tmwa/barterhandler.cpp
new file mode 100644
index 000000000..04fb20de3
--- /dev/null
+++ b/src/net/tmwa/barterhandler.cpp
@@ -0,0 +1,43 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2019 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "net/tmwa/barterhandler.h"
+
+#include "debug.h"
+
+namespace TmwAthena
+{
+
+BarterHandler::BarterHandler() :
+ Net::BarterHandler()
+{
+ barterHandler = this;
+}
+
+BarterHandler::~BarterHandler()
+{
+ barterHandler = nullptr;
+}
+
+void BarterHandler::close() const
+{
+}
+
+} // namespace TmwAthena
diff --git a/src/net/tmwa/barterhandler.h b/src/net/tmwa/barterhandler.h
new file mode 100644
index 000000000..359e4ec72
--- /dev/null
+++ b/src/net/tmwa/barterhandler.h
@@ -0,0 +1,42 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2019 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NET_TMWA_BARTERHANDLER_H
+#define NET_TMWA_BARTERHANDLER_H
+
+#include "net/barterhandler.h"
+
+namespace TmwAthena
+{
+class BarterHandler final : public Net::BarterHandler
+{
+ public:
+ BarterHandler();
+
+ A_DELETE_COPY(BarterHandler)
+
+ ~BarterHandler() override final;
+
+ void close() const override final;
+};
+
+} // namespace TmwAthena
+
+#endif // NET_TMWA_BARTERHANDLER_H
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index b85c7658c..994be2ce7 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -55,6 +55,7 @@
#include "net/tmwa/achievementhandler.h"
#include "net/tmwa/attendancehandler.h"
#include "net/tmwa/bankhandler.h"
+#include "net/tmwa/barterhandler.h"
#include "net/tmwa/battlegroundhandler.h"
#include "net/tmwa/buyingstorehandler.h"
#include "net/tmwa/cashshophandler.h"
@@ -114,6 +115,7 @@ GeneralHandler::GeneralHandler() :
mMailHandler(new MailHandler),
mMapHandler(new MapHandler),
mMarketHandler(new MarketHandler),
+ mBarterHandler(new BarterHandler),
mMercenaryHandler(new MercenaryHandler),
mRouletteHandler(new RouletteHandler),
mSearchStoreHandler(new SearchStoreHandler),
@@ -161,6 +163,7 @@ GeneralHandler::~GeneralHandler()
delete2(mMailHandler)
delete2(mMapHandler)
delete2(mMarketHandler)
+ delete2(mBarterHandler)
delete2(mMercenaryHandler)
delete2(mRouletteHandler)
delete2(mSearchStoreHandler)
diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h
index d3961fcab..b2ded08a5 100644
--- a/src/net/tmwa/generalhandler.h
+++ b/src/net/tmwa/generalhandler.h
@@ -28,6 +28,7 @@
namespace TmwAthena
{
class AdminHandler;
+class BarterHandler;
class BeingHandler;
class BuySellHandler;
class CharServerHandler;
@@ -128,6 +129,7 @@ class GeneralHandler final : public Net::GeneralHandler
MailHandler *mMailHandler;
MapHandler *mMapHandler;
MarketHandler *mMarketHandler;
+ BarterHandler *mBarterHandler;
MercenaryHandler *mMercenaryHandler;
RouletteHandler *mRouletteHandler;
SearchStoreHandler *mSearchStoreHandler;