From 0d323563e4cc507e58ce1bb3ba632cf2310602c9 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 18 Aug 2013 13:26:37 +0200 Subject: Added cWindow property manipulation API. Now enchantment table and furnace properties can be set by a plugin --- source/UI/Window.cpp | 26 ++++++++++++++++++++++++-- source/UI/Window.h | 10 ++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) (limited to 'source/UI') diff --git a/source/UI/Window.cpp b/source/UI/Window.cpp index 415ce08ff..786ae6ed1 100644 --- a/source/UI/Window.cpp +++ b/source/UI/Window.cpp @@ -664,12 +664,12 @@ void cWindow::BroadcastWholeWindow(void) -void cWindow::BroadcastInventoryProgress(short a_Progressbar, short a_Value) +void cWindow::BroadcastProgress(int a_Progressbar, int a_Value) { cCSLock Lock(m_CS); for (cPlayerList::iterator itr = m_OpenedBy.begin(); itr != m_OpenedBy.end(); ++itr) { - (*itr)->GetClientHandle()->SendInventoryProgress(m_WindowID, a_Progressbar, a_Value); + (*itr)->GetClientHandle()->SendWindowProperty(*this, a_Progressbar, a_Value); } // for itr - m_OpenedBy[] } @@ -677,6 +677,28 @@ void cWindow::BroadcastInventoryProgress(short a_Progressbar, short a_Value) +void cWindow::SetProperty(int a_Property, int a_Value) +{ + cCSLock Lock(m_CS); + for (cPlayerList::iterator itr = m_OpenedBy.begin(), end = m_OpenedBy.end(); itr != end; ++itr) + { + (*itr)->GetClientHandle()->SendWindowProperty(*this, a_Property, a_Value); + } // for itr - m_OpenedBy[] +} + + + + + +void cWindow::SetProperty(int a_Property, int a_Value, cPlayer & a_Player) +{ + a_Player.GetClientHandle()->SendWindowProperty(*this, a_Property, a_Value); +} + + + + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // cInventoryWindow: diff --git a/source/UI/Window.h b/source/UI/Window.h index 0be43e819..aa7e9d0d0 100644 --- a/source/UI/Window.h +++ b/source/UI/Window.h @@ -120,14 +120,20 @@ public: /// Sends the contents of the whole window to all clients of this window. void BroadcastWholeWindow(void); - /// Sends the progressbar to all clients of this window - void BroadcastInventoryProgress(short a_Progressbar, short a_Value); + /// Sends the progressbar to all clients of this window (same as SetProperty) + void BroadcastProgress(int a_Progressbar, int a_Value); // tolua_begin const AString & GetWindowTitle() const { return m_WindowTitle; } void SetWindowTitle(const AString & a_WindowTitle ) { m_WindowTitle = a_WindowTitle; } + /// Sends the UpdateWindowProperty (0x69) packet to all clients of the window + void SetProperty(int a_Property, int a_Value); + + /// Sends the UpdateWindowPropert(0x69) packet to the specified player + void SetProperty(int a_Property, int a_Value, cPlayer & a_Player); + // tolua_end void OwnerDestroyed(void); -- cgit v1.2.3