diff options
-rw-r--r-- | src/gui/windows/buyselldialog.cpp | 5 | ||||
-rw-r--r-- | src/net/eathena/npchandler.cpp | 8 | ||||
-rw-r--r-- | src/net/eathena/npchandler.h | 2 | ||||
-rw-r--r-- | src/net/npchandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/npchandler.cpp | 7 | ||||
-rw-r--r-- | src/net/tmwa/npchandler.h | 2 |
6 files changed, 25 insertions, 1 deletions
diff --git a/src/gui/windows/buyselldialog.cpp b/src/gui/windows/buyselldialog.cpp index 6969b8fc0..0914dc43e 100644 --- a/src/gui/windows/buyselldialog.cpp +++ b/src/gui/windows/buyselldialog.cpp @@ -133,7 +133,10 @@ void BuySellDialog::action(const ActionEvent &event) if (mNpcId != BeingId_negOne) { const Being *const being = actorManager->findBeing(mNpcId); - npcHandler->buy(being); + if (being) + npcHandler->buy(being); + else + npcHandler->buy(mNpcId); } else { diff --git a/src/net/eathena/npchandler.cpp b/src/net/eathena/npchandler.cpp index 6cb30bb81..5f2da7255 100644 --- a/src/net/eathena/npchandler.cpp +++ b/src/net/eathena/npchandler.cpp @@ -133,6 +133,14 @@ void NpcHandler::buy(const Being *const being) const EAthena::NpcRecv::mNpcTypeId = being->getSubType(); } +void NpcHandler::buy(const BeingId beingId) const +{ + createOutPacket(CMSG_NPC_BUY_SELL_REQUEST); + outMsg.writeBeingId(beingId, "npc id"); + outMsg.writeInt8(0, "action"); + EAthena::NpcRecv::mNpcTypeId = BeingTypeId_zero; +} + void NpcHandler::sell(const BeingId beingId) const { createOutPacket(CMSG_NPC_BUY_SELL_REQUEST); diff --git a/src/net/eathena/npchandler.h b/src/net/eathena/npchandler.h index d13d0f0cc..a2962eea0 100644 --- a/src/net/eathena/npchandler.h +++ b/src/net/eathena/npchandler.h @@ -52,6 +52,8 @@ class NpcHandler final : public Ea::NpcHandler void buy(const Being *const being) const override final; + void buy(const BeingId beingId) const override final; + void sell(const BeingId beingId) const override final; void buyItem(const BeingId beingId, diff --git a/src/net/npchandler.h b/src/net/npchandler.h index 040b191a9..af92eb0b1 100644 --- a/src/net/npchandler.h +++ b/src/net/npchandler.h @@ -76,6 +76,8 @@ class NpcHandler notfinal virtual void buy(const Being *const being) const = 0; + virtual void buy(const BeingId beingId) const = 0; + virtual void sell(const BeingId beingId) const = 0; virtual void buyItem(const BeingId beingId, diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index b892e152a..898e9fff4 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -117,6 +117,13 @@ void NpcHandler::buy(const Being *const being) const outMsg.writeInt8(0, "action"); } +void NpcHandler::buy(const BeingId beingId) const +{ + createOutPacket(CMSG_NPC_BUY_SELL_REQUEST); + outMsg.writeBeingId(beingId, "npc id"); + outMsg.writeInt8(0, "action"); +} + void NpcHandler::sell(const BeingId beingId) const { createOutPacket(CMSG_NPC_BUY_SELL_REQUEST); diff --git a/src/net/tmwa/npchandler.h b/src/net/tmwa/npchandler.h index f54c6911d..714bcbd65 100644 --- a/src/net/tmwa/npchandler.h +++ b/src/net/tmwa/npchandler.h @@ -52,6 +52,8 @@ class NpcHandler final : public Ea::NpcHandler void buy(const Being *const being) const override final; + void buy(const BeingId beingId) const override final; + void sell(const BeingId beingId) const override final; void buyItem(const BeingId beingId, |