summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua9
-rw-r--r--source/Bindings.cpp71
-rw-r--r--source/Bindings.h2
-rw-r--r--source/BlockEntities/FurnaceEntity.cpp2
-rw-r--r--source/ClientHandle.cpp34
-rw-r--r--source/ClientHandle.h2
-rw-r--r--source/Protocol/Protocol.h2
-rw-r--r--source/Protocol/Protocol125.cpp30
-rw-r--r--source/Protocol/Protocol125.h2
-rw-r--r--source/Protocol/ProtocolRecognizer.cpp4
-rw-r--r--source/Protocol/ProtocolRecognizer.h2
-rw-r--r--source/UI/Window.cpp26
-rw-r--r--source/UI/Window.h10
13 files changed, 151 insertions, 45 deletions
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index e864cfe92..2041b17ee 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -35,6 +35,7 @@ function Initialize(Plugin)
PluginManager:BindCommand("/starve", "debuggers", HandleStarveCmd, "- Sets the food level to zero");
PluginManager:BindCommand("/fl", "debuggers", HandleFoodLevelCmd, "- Sets the food level to the given value");
PluginManager:BindCommand("/spidey", "debuggers", HandleSpideyCmd, "- Shoots a line of web blocks until it hits non-air");
+ PluginManager:BindCommand("/ench", "debuggers", HandleEnchCmd, "- Provides an instant dummy enchantment window");
-- Enable the following line for BlockArea / Generator interface testing:
-- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED);
@@ -739,3 +740,11 @@ end
+
+function HandleEnchCmd(a_Split, a_Player)
+ local Wnd = cLuaWindow(cWindow.Enchantment, 1, 1, "Ench")
+ a_Player:OpenWindow(Wnd)
+ Wnd:SetProperty(0, 10)
+ Wnd:SetProperty(1, 15)
+ Wnd:SetProperty(2, 25)
+end \ No newline at end of file
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index 6a5ff3e32..d33be08ac 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 08/18/13 10:47:30.
+** Generated automatically by tolua++-1.0.92 on 08/18/13 13:15:34.
*/
#ifndef __cplusplus
@@ -26657,6 +26657,73 @@ static int tolua_AllToLua_cWindow_SetWindowTitle00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
+/* method: SetProperty of class cWindow */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_SetProperty00
+static int tolua_AllToLua_cWindow_SetProperty00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cWindow",0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cWindow* self = (cWindow*) tolua_tousertype(tolua_S,1,0);
+ int a_Property = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_Value = ((int) tolua_tonumber(tolua_S,3,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetProperty'", NULL);
+#endif
+ {
+ self->SetProperty(a_Property,a_Value);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'SetProperty'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: SetProperty of class cWindow */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_SetProperty01
+static int tolua_AllToLua_cWindow_SetProperty01(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cWindow",0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
+ (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"cPlayer",0,&tolua_err)) ||
+ !tolua_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+ cWindow* self = (cWindow*) tolua_tousertype(tolua_S,1,0);
+ int a_Property = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_Value = ((int) tolua_tonumber(tolua_S,3,0));
+ cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,4,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetProperty'", NULL);
+#endif
+ {
+ self->SetProperty(a_Property,a_Value,*a_Player);
+ }
+ }
+ return 0;
+tolua_lerror:
+ return tolua_AllToLua_cWindow_SetProperty00(tolua_S);
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: new of class cLuaWindow */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaWindow_new00
static int tolua_AllToLua_cLuaWindow_new00(lua_State* tolua_S)
@@ -28610,6 +28677,8 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"IsSlotInPlayerInventory",tolua_AllToLua_cWindow_IsSlotInPlayerInventory00);
tolua_function(tolua_S,"GetWindowTitle",tolua_AllToLua_cWindow_GetWindowTitle00);
tolua_function(tolua_S,"SetWindowTitle",tolua_AllToLua_cWindow_SetWindowTitle00);
+ tolua_function(tolua_S,"SetProperty",tolua_AllToLua_cWindow_SetProperty00);
+ tolua_function(tolua_S,"SetProperty",tolua_AllToLua_cWindow_SetProperty01);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"cLuaWindow","cLuaWindow","cWindow",tolua_collect_cLuaWindow);
diff --git a/source/Bindings.h b/source/Bindings.h
index 55baed803..a403294a9 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 08/18/13 10:47:31.
+** Generated automatically by tolua++-1.0.92 on 08/18/13 13:15:34.
*/
/* Exported function */
diff --git a/source/BlockEntities/FurnaceEntity.cpp b/source/BlockEntities/FurnaceEntity.cpp
index e1b6fc47b..6cac8573d 100644
--- a/source/BlockEntities/FurnaceEntity.cpp
+++ b/source/BlockEntities/FurnaceEntity.cpp
@@ -220,7 +220,7 @@ void cFurnaceEntity::BroadcastProgress(int a_ProgressbarID, short a_Value)
cWindow * Window = GetWindow();
if (Window != NULL)
{
- Window->BroadcastInventoryProgress(a_ProgressbarID, a_Value);
+ Window->BroadcastProgress(a_ProgressbarID, a_Value);
}
}
diff --git a/source/ClientHandle.cpp b/source/ClientHandle.cpp
index dce2bbd25..4372d052c 100644
--- a/source/ClientHandle.cpp
+++ b/source/ClientHandle.cpp
@@ -1718,15 +1718,6 @@ void cClientHandle::SendHealth(void)
-void cClientHandle::SendInventoryProgress(char a_WindowID, short a_ProgressBar, short a_Value)
-{
- m_Protocol->SendInventoryProgress(a_WindowID, a_ProgressBar, a_Value);
-}
-
-
-
-
-
void cClientHandle::SendInventorySlot(char a_WindowID, short a_SlotNum, const cItem & a_Item)
{
m_Protocol->SendInventorySlot(a_WindowID, a_SlotNum, a_Item);
@@ -1954,36 +1945,45 @@ void cClientHandle::SendWeather(eWeather a_Weather)
-void cClientHandle::SendWindowClose(const cWindow & a_Window)
+void cClientHandle::SendWholeInventory(const cInventory & a_Inventory)
{
- m_Protocol->SendWindowClose(a_Window);
+ m_Protocol->SendWholeInventory(a_Inventory);
}
-void cClientHandle::SendWindowOpen(char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots)
+void cClientHandle::SendWholeInventory(const cWindow & a_Window)
{
- m_Protocol->SendWindowOpen(a_WindowID, a_WindowType, a_WindowTitle, a_NumSlots);
+ m_Protocol->SendWholeInventory(a_Window);
}
-void cClientHandle::SendWholeInventory(const cInventory & a_Inventory)
+void cClientHandle::SendWindowClose(const cWindow & a_Window)
{
- m_Protocol->SendWholeInventory(a_Inventory);
+ m_Protocol->SendWindowClose(a_Window);
}
-void cClientHandle::SendWholeInventory(const cWindow & a_Window)
+void cClientHandle::SendWindowOpen(char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots)
{
- m_Protocol->SendWholeInventory(a_Window);
+ m_Protocol->SendWindowOpen(a_WindowID, a_WindowType, a_WindowTitle, a_NumSlots);
+}
+
+
+
+
+
+void cClientHandle::SendWindowProperty(const cWindow & a_Window, int a_Property, int a_Value)
+{
+ m_Protocol->SendWindowProperty(a_Window, a_Property, a_Value);
}
diff --git a/source/ClientHandle.h b/source/ClientHandle.h
index 9454b9b7a..c85257df1 100644
--- a/source/ClientHandle.h
+++ b/source/ClientHandle.h
@@ -111,7 +111,6 @@ public:
void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion);
void SendGameMode (eGameMode a_GameMode);
void SendHealth (void);
- void SendInventoryProgress (char a_WindowID, short a_Progressbar, short a_Value);
void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item);
void SendPickupSpawn (const cPickup & a_Pickup);
void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation);
@@ -139,6 +138,7 @@ public:
void SendWholeInventory (const cWindow & a_Window);
void SendWindowClose (const cWindow & a_Window);
void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots);
+ void SendWindowProperty (const cWindow & a_Window, int a_Property, int a_Value);
const AString & GetUsername(void) const; // tolua_export
void SetUsername( const AString & a_Username ); // tolua_export
diff --git a/source/Protocol/Protocol.h b/source/Protocol/Protocol.h
index 5c46b2726..0953071b1 100644
--- a/source/Protocol/Protocol.h
+++ b/source/Protocol/Protocol.h
@@ -73,7 +73,6 @@ public:
virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) = 0;
virtual void SendGameMode (eGameMode a_GameMode) = 0;
virtual void SendHealth (void) = 0;
- virtual void SendInventoryProgress (char a_WindowID, short a_Progressbar, short a_Value) = 0;
virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) = 0;
virtual void SendKeepAlive (int a_PingID) = 0;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) = 0;
@@ -103,6 +102,7 @@ public:
virtual void SendWholeInventory (const cWindow & a_Window) = 0;
virtual void SendWindowClose (const cWindow & a_Window) = 0;
virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) = 0;
+ virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) = 0;
/// Returns the ServerID used for authentication through session.minecraft.net
virtual AString GetAuthServerID(void) = 0;
diff --git a/source/Protocol/Protocol125.cpp b/source/Protocol/Protocol125.cpp
index e481bb9a7..6f79ed12c 100644
--- a/source/Protocol/Protocol125.cpp
+++ b/source/Protocol/Protocol125.cpp
@@ -82,7 +82,7 @@ enum
PACKET_WINDOW_CLICK = 0x66,
PACKET_INVENTORY_SLOT = 0x67,
PACKET_INVENTORY_WHOLE = 0x68,
- PACKET_INVENTORY_PROGRESS = 0x69,
+ PACKET_WINDOW_PROPERTY = 0x69,
PACKET_CREATIVE_INVENTORY_ACTION = 0x6B,
PACKET_UPDATE_SIGN = 0x82,
PACKET_PLAYER_LIST_ITEM = 0xC9,
@@ -491,20 +491,6 @@ void cProtocol125::SendHealth(void)
-void cProtocol125::SendInventoryProgress(char a_WindowID, short a_ProgressBar, short a_Value)
-{
- cCSLock Lock(m_CSPacket);
- WriteByte (PACKET_INVENTORY_PROGRESS);
- WriteByte (a_WindowID);
- WriteShort(a_ProgressBar);
- WriteShort(a_Value);
- Flush();
-}
-
-
-
-
-
void cProtocol125::SendInventorySlot(char a_WindowID, short a_SlotNum, const cItem & a_Item)
{
cCSLock Lock(m_CSPacket);
@@ -975,6 +961,20 @@ void cProtocol125::SendWindowOpen(char a_WindowID, char a_WindowType, const AStr
+void cProtocol125::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value)
+{
+ cCSLock Lock(m_CSPacket);
+ WriteByte (PACKET_WINDOW_PROPERTY);
+ WriteByte (a_Window.GetWindowID());
+ WriteShort(a_Property);
+ WriteShort(a_Value);
+ Flush();
+}
+
+
+
+
+
AString cProtocol125::GetAuthServerID(void)
{
// http://wiki.vg/wiki/index.php?title=Session&oldid=2262
diff --git a/source/Protocol/Protocol125.h b/source/Protocol/Protocol125.h
index ee8fd94eb..ec6e12a0d 100644
--- a/source/Protocol/Protocol125.h
+++ b/source/Protocol/Protocol125.h
@@ -50,7 +50,6 @@ public:
virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) override;
virtual void SendGameMode (eGameMode a_GameMode) override;
virtual void SendHealth (void) override;
- virtual void SendInventoryProgress (char a_WindowID, short a_Progressbar, short a_Value) override;
virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override;
virtual void SendKeepAlive (int a_PingID) override;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
@@ -80,6 +79,7 @@ public:
virtual void SendWholeInventory (const cWindow & a_Window) override;
virtual void SendWindowClose (const cWindow & a_Window) override;
virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
+ virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) override;
virtual AString GetAuthServerID(void) override;
diff --git a/source/Protocol/ProtocolRecognizer.cpp b/source/Protocol/ProtocolRecognizer.cpp
index 35c8fe993..ef2ed91f6 100644
--- a/source/Protocol/ProtocolRecognizer.cpp
+++ b/source/Protocol/ProtocolRecognizer.cpp
@@ -332,10 +332,10 @@ void cProtocolRecognizer::SendHealth(void)
-void cProtocolRecognizer::SendInventoryProgress(char a_WindowID, short a_Progressbar, short a_Value)
+void cProtocolRecognizer::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value)
{
ASSERT(m_Protocol != NULL);
- m_Protocol->SendInventoryProgress(a_WindowID, a_Progressbar, a_Value);
+ m_Protocol->SendWindowProperty(a_Window, a_Property, a_Value);
}
diff --git a/source/Protocol/ProtocolRecognizer.h b/source/Protocol/ProtocolRecognizer.h
index 43d4a15e2..94bbb184f 100644
--- a/source/Protocol/ProtocolRecognizer.h
+++ b/source/Protocol/ProtocolRecognizer.h
@@ -80,7 +80,6 @@ public:
virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) override;
virtual void SendGameMode (eGameMode a_GameMode) override;
virtual void SendHealth (void) override;
- virtual void SendInventoryProgress (char a_WindowID, short a_Progressbar, short a_Value) override;
virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override;
virtual void SendKeepAlive (int a_PingID) override;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
@@ -110,6 +109,7 @@ public:
virtual void SendWholeInventory (const cWindow & a_Window) override;
virtual void SendWindowClose (const cWindow & a_Window) override;
virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
+ virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) override;
virtual AString GetAuthServerID(void) override;
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);