summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2017-08-27 23:37:39 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2017-08-30 19:00:17 +0200
commit5481249d0f6025251e811f2e35daa79ee7c258aa (patch)
tree6f2bfd59cbf4d11b1236b8c24e1b1b7dd09077f5 /src/ClientHandle.cpp
parentMerge pull request #3969 from peterbell10/cuboid (diff)
downloadcuberite-5481249d0f6025251e811f2e35daa79ee7c258aa.tar
cuberite-5481249d0f6025251e811f2e35daa79ee7c258aa.tar.gz
cuberite-5481249d0f6025251e811f2e35daa79ee7c258aa.tar.bz2
cuberite-5481249d0f6025251e811f2e35daa79ee7c258aa.tar.lz
cuberite-5481249d0f6025251e811f2e35daa79ee7c258aa.tar.xz
cuberite-5481249d0f6025251e811f2e35daa79ee7c258aa.tar.zst
cuberite-5481249d0f6025251e811f2e35daa79ee7c258aa.zip
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r--src/ClientHandle.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 6923c9855..13c22de52 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -17,6 +17,7 @@
#include "UI/AnvilWindow.h"
#include "UI/BeaconWindow.h"
#include "UI/EnchantingWindow.h"
+#include "UI/VillagerTradeWindow.h"
#include "Item.h"
#include "Mobs/Monster.h"
#include "ChatColor.h"
@@ -670,8 +671,14 @@ void cClientHandle::RemoveFromAllChunks()
void cClientHandle::HandleNPCTrade(int a_SlotNum)
{
- // TODO
- LOGWARNING("%s: Not implemented yet", __FUNCTION__);
+ auto CurrentWindow = GetPlayer()->GetWindow();
+ if ((CurrentWindow == nullptr) || CurrentWindow->GetWindowType() != cWindow::WindowType::wtVillagerTrade)
+ {
+ Kick("Received trade selection when no trade in progress - hacked client?");
+ return;
+ }
+
+ static_cast<cVillagerTradeWindow *>(CurrentWindow)->PlayerChangedTradeOffer(*GetPlayer(), static_cast<unsigned>(a_SlotNum));
}
@@ -3111,6 +3118,11 @@ void cClientHandle::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_Blo
m_Protocol->SendUseBed(a_Entity, a_BlockX, a_BlockY, a_BlockZ);
}
+void cClientHandle::SendVillagerTradeList(const cWindow & TradeWindow, const std::vector<VillagerTradeOffer> & TradeOffers)
+{
+ m_Protocol->SendVillagerTradeList(TradeWindow, TradeOffers);
+}
+