summaryrefslogtreecommitdiffstats
path: root/source/cCreativeInventory.cpp
blob: 7083adeb7e177899ce4f01e9929fa4e5246cbcbe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

#include "Globals.h"  // NOTE: MSVC stupidness requires this to be the same across all modules

#include "cCreativeInventory.h"
#include "cPlayer.h"
#include "cClientHandle.h"
#include "cWindow.h"
#include "cItem.h"
#include "cRoot.h"

#include <json/json.h>

#include "packets/cPacket_CreativeInventoryAction.h"
#include "packets/cPacket_WholeInventory.h"
#include "packets/cPacket_InventorySlot.h"

cCreativeInventory::~cCreativeInventory()
{
}

cCreativeInventory::cCreativeInventory(cPlayer* a_Owner)
	: cInventory(a_Owner)
{
	
}

void cCreativeInventory::Clicked( cPacket* a_ClickPacket )
{
	cPacket_CreativeInventoryAction* Packet = reinterpret_cast<cPacket_CreativeInventoryAction *>(a_ClickPacket);
	short Slot = Packet->m_Slot;

	cItem* SlotItem = &(this->m_Slots[Slot]);

	SlotItem->m_ItemID = (ENUM_ITEM_ID) Packet->m_ItemID;
	SlotItem->m_ItemHealth = Packet->m_Damage;
	SlotItem->m_ItemCount = Packet->m_Quantity;
}