From 4a879f52c53c4fb9542319bc1f5864998a1fbb22 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 25 Jan 2019 22:01:11 +0300 Subject: Add packet CMSG_NPC_BARTER_CLOSE 0x0b12 --- src/net/eathena/barterhandler.cpp | 60 ++++++++++++++++++++++++++++++++++++++ src/net/eathena/barterhandler.h | 43 +++++++++++++++++++++++++++ src/net/eathena/barterrecv.cpp | 40 +++++++++++++++++++++++++ src/net/eathena/barterrecv.h | 39 +++++++++++++++++++++++++ src/net/eathena/generalhandler.cpp | 3 ++ src/net/eathena/generalhandler.h | 2 ++ src/net/eathena/packetsout.inc | 21 ++++++++++++- 7 files changed, 207 insertions(+), 1 deletion(-) create mode 100644 src/net/eathena/barterhandler.cpp create mode 100644 src/net/eathena/barterhandler.h create mode 100644 src/net/eathena/barterrecv.cpp create mode 100644 src/net/eathena/barterrecv.h (limited to 'src/net/eathena') 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 . + */ + +#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 . + */ + +#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 . + */ + +#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 . + */ + +#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 -- cgit v1.2.3-70-g09d2