|
Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Go to the documentation of this file.
12 #include "../FunctionRef.h"
13 #include "../ItemGrid.h"
119 cPlayer & a_Player,
int a_WindowID,
121 const cItem & a_ClickedItem
145 virtual void SetProperty(
size_t a_Property,
short a_Value);
Base class for the window owning.
void OnPaintProgress(cPlayer &a_Player, int a_SlotNum)
Adds the slot to the internal structures for inventory painting by the specified player.
void DistributeStackToAreas(cItem &a_ItemStack, cPlayer &a_Player, cSlotAreas &a_AreasInOrder, bool a_ShouldApply, bool a_BackFill)
Called from DistributeStack() to distribute the stack into a_AreasInOrder; Modifies a_ItemStack as it...
eClickAction
Individual actions sent in the WindowClick packet.
void SetWindowTitle(const AString &a_WindowTitle)
void SendWholeWindow(cClientHandle &a_Client)
Sends the contents of the whole window to the specified client.
const AString & GetWindowTitle() const
void OwnerDestroyed(void)
bool CollectItemsToHand(cItem &a_Dragging, cSlotArea &a_Area, cPlayer &a_Player, bool a_CollectFullStacks)
Called on DblClicking to collect all stackable items from all areas into hand.
int GetWindowType(void) const
void BroadcastWholeWindow(void)
Sends the contents of the whole window to all clients of this window.
char GetWindowID(void) const
cWindowOwner * GetOwner(void)
static Byte m_WindowIDCounter
bool ForEachClient(cClientHandleCallback a_Callback)
Calls the callback safely for each client that has this window open; returns true if all clients have...
void OnLeftPaintEnd(cPlayer &a_Player)
Processes the entire action stored in the internal structures for inventory painting; distributes as ...
virtual void Destroy(void)
Sets the internal flag as "destroyed"; notifies the owner that the window is destroying.
const cItem * GetSlot(cPlayer &a_Player, int a_SlotNum) const
Returns the item at the specified slot for the specified player.
void OnMiddlePaintEnd(cPlayer &a_Player)
Processes the entire action stored in the internal structures for inventory painting; distributes a f...
std::vector< int > cSlotNums
List of slot numbers, used for inventory-painting.
static const int c_NumInventorySlots
virtual void Clicked(cPlayer &a_Player, int a_WindowID, short a_SlotNum, eClickAction a_ClickAction, const cItem &a_ClickedItem)
Handles a click event from a player.
void SetSlot(cPlayer &a_Player, int a_SlotNum, const cItem &a_Item)
Sets the item to the specified slot for the specified player.
void BroadcastSlot(cSlotArea *a_Area, int a_LocalSlotNum)
Sends the specified slot's contents to all clients of this window; the slot is specified as local in ...
virtual void OpenedByPlayer(cPlayer &a_Player)
cSlotArea * GetSlotArea(int a_GlobalSlotNum, int &a_LocalSlotNum)
Returns the correct slot area for the specified window-global SlotNum Also returns the area-local Slo...
void OnPaintBegin(cPlayer &a_Player)
Prepares the internal structures for inventory painting from the specified player.
bool IsSlotInPlayerInventory(int a_SlotNum) const
Returns true if the specified slot is in the Player Main Inventory or Hotbar slotareas.
virtual void SetProperty(size_t a_Property, short a_Value)
Updates a numerical property associated with the window.
void GetSlots(cPlayer &a_Player, cItems &a_Slots) const
Fills a_Slots with the slots read from m_SlotAreas[], for the specified player.
void OnRightPaintEnd(cPlayer &a_Player)
Processes the entire action stored in the internal structures for inventory painting; distributes one...
std::list< cPlayer * > cPlayerList
This class bridges a vector of cItem for safe access via Lua.
void SetOwner(cWindowOwner *a_Owner)
bool IsSlotInPlayerMainInventory(int a_SlotNum) const
Returns true if the specified slot is in the Player Main Inventory slotarea.
int GetNumSlots(void) const
Returns the total number of slots.
int GetNumNonInventorySlots(void) const
Returns the number of slots, excluding the player's inventory (used for network protocols)
char DistributeItemToSlots(cPlayer &a_Player, const cItem &a_Item, char a_NumToEachSlot, const cSlotNums &a_SlotNums, bool a_LimitItems=true)
Distributes a_NumToEachSlot items into the slots specified in a_SlotNums; returns the total number of...
virtual void DistributeStack(cItem &a_ItemStack, int a_Slot, cPlayer &a_Player, cSlotArea *a_ClickedArea, bool a_ShouldApply)=0
Called on shift-clicking to distribute the stack into other areas; Modifies a_ItemStack as it is dist...
bool IsSlotInPlayerHotbar(int a_SlotNum) const
Returns true if the specified slot is in the Player Hotbar slotarea.
void SendSlot(cPlayer &a_Player, cSlotArea *a_SlotArea, int a_RelativeSlotNum)
Used by cSlotAreas to send individual slots to clients, a_RelativeSlotNum is the slot number relative...
std::vector< cSlotArea * > cSlotAreas
cWindow(WindowType a_WindowType, const AString &a_WindowTitle)
const AString GetWindowTypeName(void) const
Returns the textual representation of the window's type, such as "minecraft:chest".
virtual bool ClosedByPlayer(cPlayer &a_Player, bool a_CanRefuse)
Called when a player closes this window; notifies all slot areas.
bool ForEachPlayer(cPlayerListCallback a_Callback)
Calls the callback safely for each player that has this window open; returns true if all players have...