From 2452dcf6d7a55fbccccfd7ea426d0e976023a52a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 6 Jan 2015 13:50:52 +0300 Subject: eathena: add packet CMSG_AUCTION_SET_ITEM 0x024c. --- src/net/auctionhandler.h | 5 +++++ src/net/eathena/auctionhandler.cpp | 13 +++++++++++++ src/net/eathena/auctionhandler.h | 3 +++ src/net/eathena/protocol.h | 1 + src/net/tmwa/auctionhandler.cpp | 5 +++++ src/net/tmwa/auctionhandler.h | 3 +++ 6 files changed, 30 insertions(+) diff --git a/src/net/auctionhandler.h b/src/net/auctionhandler.h index 75da1ca2e..b449faa31 100644 --- a/src/net/auctionhandler.h +++ b/src/net/auctionhandler.h @@ -25,6 +25,8 @@ #include "localconsts.h" +class Item; + namespace Net { @@ -35,6 +37,9 @@ class AuctionHandler notfinal { } virtual void cancelRequest() const = 0; + + virtual void setItem(const Item *const item, + const int amount) const = 0; }; } // namespace Net diff --git a/src/net/eathena/auctionhandler.cpp b/src/net/eathena/auctionhandler.cpp index 679786bb6..bcdc94aea 100644 --- a/src/net/eathena/auctionhandler.cpp +++ b/src/net/eathena/auctionhandler.cpp @@ -20,6 +20,10 @@ #include "net/eathena/auctionhandler.h" +#include "item.h" + +#include "net/ea/eaprotocol.h" + #include "net/eathena/messageout.h" #include "net/eathena/protocol.h" @@ -106,4 +110,13 @@ void AuctionHandler::cancelRequest() const outMsg.writeInt16(0, "type"); // unused } +void AuctionHandler::setItem(const Item *const item, + const int amount) const +{ + createOutPacket(CMSG_AUCTION_SET_ITEM); + outMsg.writeInt16(static_cast( + item->getInvIndex() + INVENTORY_OFFSET), "index"); + outMsg.writeInt32(amount, "amount"); // always 1 +} + } // namespace EAthena diff --git a/src/net/eathena/auctionhandler.h b/src/net/eathena/auctionhandler.h index a4c166613..d1c4a2b53 100644 --- a/src/net/eathena/auctionhandler.h +++ b/src/net/eathena/auctionhandler.h @@ -38,6 +38,9 @@ class AuctionHandler final : public MessageHandler, public Net::AuctionHandler void cancelRequest() const override final; + void setItem(const Item *const item, + const int amount) const override final; + protected: static void processOpenWindow(Net::MessageIn &msg); diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index b02b6e79c..e57cfd197 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -515,5 +515,6 @@ #define CMSG_FRIENDS_DELETE_PLAYER 0x020a #define CMSG_AUCTION_CANCEL_REQUEST 0x024b +#define CMSG_AUCTION_SET_ITEM 0x024c #endif // NET_EATHENA_PROTOCOL_H diff --git a/src/net/tmwa/auctionhandler.cpp b/src/net/tmwa/auctionhandler.cpp index e14d0d375..6197c7db8 100644 --- a/src/net/tmwa/auctionhandler.cpp +++ b/src/net/tmwa/auctionhandler.cpp @@ -46,4 +46,9 @@ void AuctionHandler::cancelRequest() const { } +void AuctionHandler::setItem(const Item *const item A_UNUSED, + const int amount A_UNUSED) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/auctionhandler.h b/src/net/tmwa/auctionhandler.h index c3c624ea4..873d987e3 100644 --- a/src/net/tmwa/auctionhandler.h +++ b/src/net/tmwa/auctionhandler.h @@ -38,6 +38,9 @@ class AuctionHandler final : public MessageHandler, public Net::AuctionHandler void handleMessage(Net::MessageIn &msg) override final; void cancelRequest() const override final; + + void setItem(const Item *const item, + const int amount) const override final; }; } // namespace TmwAthena -- cgit v1.2.3-60-g2f50